diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2021-02-14 17:45:04 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2022-04-05 18:50:22 +0000 |
commit | 4c94cfecfcb96c218b37234eda2f9c262821cf7c (patch) | |
tree | af8183f3dacf18298fe0f6f5493c2dc48ebcc1cd /src/blockchain_db | |
parent | ringct: port some of vtnerd's review changes from BP+ to BP (diff) | |
download | monero-4c94cfecfcb96c218b37234eda2f9c262821cf7c.tar.xz |
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
Diffstat (limited to 'src/blockchain_db')
-rw-r--r-- | src/blockchain_db/blockchain_db.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp index a84a4148d..8e68abbe5 100644 --- a/src/blockchain_db/blockchain_db.cpp +++ b/src/blockchain_db/blockchain_db.cpp @@ -241,8 +241,15 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const std::pair } else { + rct::key commitment; + if (tx.version > 1) + { + commitment = tx.rct_signatures.outPk[i].mask; + if (rct::is_rct_bulletproof_plus(tx.rct_signatures.type)) + commitment = rct::scalarmult8(commitment); + } amount_output_indices[i] = add_output(tx_hash, tx.vout[i], i, tx.unlock_time, - tx.version > 1 ? &tx.rct_signatures.outPk[i].mask : NULL); + tx.version > 1 ? &commitment : NULL); } } add_tx_amount_output_indices(tx_id, amount_output_indices); |