diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-07-31 20:09:44 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-08-28 21:30:08 +0100 |
commit | 0263dd2d23679cf5564d34011de02d5fd5f96650 (patch) | |
tree | 202ec0d7f01f4269572998969fa046869ea384f6 /src/cryptonote_core/blockchain.cpp | |
parent | wallet2: factor m_spent changes (diff) | |
download | monero-0263dd2d23679cf5564d34011de02d5fd5f96650.tar.xz |
core: add some locking around pool use
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 547f2d4c2..f6f56b086 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2869,6 +2869,8 @@ void Blockchain::return_tx_to_pool(const std::vector<transaction> &txs) //------------------------------------------------------------------ bool Blockchain::flush_txes_from_pool(const std::list<crypto::hash> &txids) { + CRITICAL_REGION_LOCAL(m_tx_pool); + bool res = true; for (const auto &txid: txids) { @@ -2877,7 +2879,7 @@ bool Blockchain::flush_txes_from_pool(const std::list<crypto::hash> &txids) uint64_t fee; bool relayed; LOG_PRINT_L1("Removing txid " << txid << " from the pool"); - if(!m_tx_pool.take_tx(txid, tx, blob_size, fee, relayed)) + if(m_tx_pool.have_tx(txid) && !m_tx_pool.take_tx(txid, tx, blob_size, fee, relayed)) { LOG_PRINT_L0("Failed to remove txid " << txid << " from the pool"); res = false; |