diff options
author | luigi1111 <luigi1111w@gmail.com> | 2018-05-29 17:56:26 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2018-05-29 17:56:26 -0500 |
commit | c534fe8d19aa20a30849ca123f0bd90314659970 (patch) | |
tree | aa2de98502f7046acb171ed10caef311d464bdf4 /src/blockchain_db/blockchain_db.cpp | |
parent | Merge pull request #3477 (diff) | |
parent | db_lmdb: save pruned and prunable tx data separately (diff) | |
download | monero-c534fe8d19aa20a30849ca123f0bd90314659970.tar.xz |
Merge pull request #3251
b9389e5 db_lmdb: save pruned and prunable tx data separately (moneromooo-monero)
Diffstat (limited to 'src/blockchain_db/blockchain_db.cpp')
-rw-r--r-- | src/blockchain_db/blockchain_db.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp index 9f760dc0d..88ac34255 100644 --- a/src/blockchain_db/blockchain_db.cpp +++ b/src/blockchain_db/blockchain_db.cpp @@ -121,10 +121,10 @@ void BlockchainDB::pop_block() pop_block(blk, txs); } -void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash* tx_hash_ptr) +void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const transaction& tx, const crypto::hash* tx_hash_ptr, const crypto::hash* tx_prunable_hash_ptr) { bool miner_tx = false; - crypto::hash tx_hash; + crypto::hash tx_hash, tx_prunable_hash; if (!tx_hash_ptr) { // should only need to compute hash for miner transactions @@ -135,6 +135,13 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const transacti { tx_hash = *tx_hash_ptr; } + if (tx.version >= 2) + { + if (!tx_prunable_hash_ptr) + tx_prunable_hash = get_transaction_prunable_hash(tx); + else + tx_prunable_hash = *tx_prunable_hash_ptr; + } for (const txin_v& tx_input : tx.vin) { @@ -161,7 +168,7 @@ void BlockchainDB::add_transaction(const crypto::hash& blk_hash, const transacti } } - uint64_t tx_id = add_transaction_data(blk_hash, tx, tx_hash); + uint64_t tx_id = add_transaction_data(blk_hash, tx, tx_hash, tx_prunable_hash); std::vector<uint64_t> amount_output_indices; |