diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-10-01 11:24:33 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-05-23 22:48:12 +0100 |
commit | b9389e582eb4e1806ce25a14fa492259c3d40dfc (patch) | |
tree | 0b1a1f43f8d781b6f4ea13cd2694b491eb7ee81d /src/blockchain_db/blockchain_db.cpp | |
parent | Merge pull request #3787 (diff) | |
download | monero-b9389e582eb4e1806ce25a14fa492259c3d40dfc.tar.xz |
db_lmdb: save pruned and prunable tx data separately
This bumps DB version to 2, migration code will run for v1 DBs
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; |