diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-08-15 18:42:29 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-08-15 18:42:29 +0100 |
commit | 3f9089a76741b40683e5243d1295b56bed48aac5 (patch) | |
tree | 69f5810cf970f95fb6e79c4f7966e53adfece6c2 /src | |
parent | blockchain: fix off by 1 in timestamp median calculations (diff) | |
download | monero-3f9089a76741b40683e5243d1295b56bed48aac5.tar.xz |
blockchain: do not try to add a tx the pool when it was nor taken out
This is an unintended difference from the old code. Though I don't
think it can actually happen in practice with the current take_tx
implementation.
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index acbd9f9a7..37e9053c7 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2365,6 +2365,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash& uint64_t t_pool = 0; uint64_t t_dblspnd = 0; uint64_t t_cc; + bool add_tx_to_pool = false; TIME_MEASURE_FINISH(t3); int tx_index = 0; @@ -2430,6 +2431,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash& add_block_as_invalid(bl, id); LOG_PRINT_L1("Block with id " << id << " added as invalid because of wrong inputs in transactions"); bvc.m_verifivation_failed = true; + add_tx_to_pool = true; break; } } @@ -2445,6 +2447,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash& add_block_as_invalid(bl, id); LOG_PRINT_L1("Block with id " << id << " added as invalid because of wrong inputs in transactions"); bvc.m_verifivation_failed = true; + add_tx_to_pool = true; break; } } @@ -2503,7 +2506,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash& // if we failed for any reason to verify the block, return taken // transactions to the tx_pool. - if (bvc.m_verifivation_failed || !add_success) + if ((bvc.m_verifivation_failed && add_tx_to_pool) || !add_success) { // return taken transactions to transaction pool for (auto& tx : txs) |