aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain_db.cpp
diff options
context:
space:
mode:
authorwarptangent <warptangent@inbox.com>2015-01-11 18:04:04 -0800
committerwarptangent <warptangent@inbox.com>2015-01-11 21:22:09 -0800
commit4d0a94b20cd6e3b03657dc4ca49bc248a1e7f230 (patch)
tree0571cb88d36cfd718f31ed65b6c7714ee31acba3 /src/cryptonote_core/blockchain_db.cpp
parentUse block index when obtaining block's difficulty for log statement (diff)
downloadmonero-4d0a94b20cd6e3b03657dc4ca49bc248a1e7f230.tar.xz
Complete implementation of transaction removal
Complete method BlockchainLMDB::remove_output() - use output index as the key for: m_output_indices, m_output_txs, m_output_keys - call new method BlockchainLMDB::remove_amount_output_index() Add method to remove amount output index. - BlockchainLMDB::remove_amount_output_index() - for m_output_amounts This also fixes the segfault when blockchain reorganization is attempted.
Diffstat (limited to 'src/cryptonote_core/blockchain_db.cpp')
-rw-r--r--src/cryptonote_core/blockchain_db.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain_db.cpp b/src/cryptonote_core/blockchain_db.cpp
index 439cf5ded..5e781af79 100644
--- a/src/cryptonote_core/blockchain_db.cpp
+++ b/src/cryptonote_core/blockchain_db.cpp
@@ -107,6 +107,9 @@ void BlockchainDB::remove_transaction(const crypto::hash& tx_hash)
{
transaction tx = get_tx(tx_hash);
+ // TODO: This loop calling remove_output() should be removed. It doesn't do
+ // anything (function is empty), and the outputs were already intended to be
+ // removed later as part of remove_transaction_data().
for (const tx_out& tx_output : tx.vout)
{
remove_output(tx_output);
@@ -120,7 +123,8 @@ void BlockchainDB::remove_transaction(const crypto::hash& tx_hash)
}
}
- remove_transaction_data(tx_hash);
+ // need tx as tx.vout has the tx outputs, and the output amounts are needed
+ remove_transaction_data(tx_hash, tx);
}
} // namespace cryptonote