cryptonote: make sure outPk setup always happens

This commit is contained in:
moneromooo-monero 2018-05-06 12:00:42 +01:00
parent 6b9d9f56a1
commit 6f859e4328
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 37 additions and 33 deletions

View file

@ -650,39 +650,6 @@ namespace cryptonote
return false;
}
// resolve outPk references in rct txes
// outPk aren't the only thing that need resolving for a fully resolved tx,
// but outPk (1) are needed now to check range proof semantics, and
// (2) do not need access to the blockchain to find data
if (tx.version >= 2)
{
rct::rctSig &rv = tx.rct_signatures;
if (rv.outPk.size() != tx.vout.size())
{
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Bad outPk size in tx " << tx_hash << ", rejected");
tvc.m_verifivation_failed = true;
return false;
}
for (size_t n = 0; n < tx.rct_signatures.outPk.size(); ++n)
rv.outPk[n].dest = rct::pk2rct(boost::get<txout_to_key>(tx.vout[n].target).key);
const bool bulletproof = rv.type == rct::RCTTypeFullBulletproof || rv.type == rct::RCTTypeSimpleBulletproof;
if (bulletproof)
{
if (rv.p.bulletproofs.size() != tx.vout.size())
{
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Bad bulletproofs size in tx " << tx_hash << ", rejected");
tvc.m_verifivation_failed = true;
return false;
}
for (size_t n = 0; n < rv.outPk.size(); ++n)
{
rv.p.bulletproofs[n].V.resize(1);
rv.p.bulletproofs[n].V[0] = rv.outPk[n].mask;
}
}
}
if (keeped_by_block && get_blockchain_storage().is_within_compiled_block_hash_area())
{
MTRACE("Skipping semantics check for tx kept by block in embedded hash area");