store outPk/8 in the tx for speed

It avoids dividing by 8 when deserializing a tx, which is a slow
operation, and multiplies by 8 when verifying and extracing the
amount, which is much faster as well as less frequent
This commit is contained in:
moneromooo-monero 2021-02-14 17:45:04 +00:00
parent a345060ace
commit 4c94cfecfc
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
5 changed files with 31 additions and 7 deletions

View file

@ -189,7 +189,7 @@ namespace cryptonote
CHECK_AND_ASSERT_MES(n_amounts == rv.outPk.size(), false, "Internal error filling out V");
rv.p.bulletproofs_plus[0].V.resize(n_amounts);
for (size_t i = 0; i < n_amounts; ++i)
rv.p.bulletproofs_plus[0].V[i] = rct::scalarmultKey(rv.outPk[i].mask, rct::INV_EIGHT);
rv.p.bulletproofs_plus[0].V[i] = rv.outPk[i].mask;
}
else if (bulletproof)
{