aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-04-15 12:29:25 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-04-15 22:27:12 +0000
commitbb0ef5b1f276e54d7e7f191c793eca5c838da4f2 (patch)
treefbc995c2ec31181c5081908a402bd7bab5ddc6cb
parentMerge pull request #5440 (diff)
downloadmonero-bb0ef5b1f276e54d7e7f191c793eca5c838da4f2.tar.xz
blockchain: lock the blockchain while pruning
-rw-r--r--src/cryptonote_core/blockchain.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 7ef8f8c45..daa1fe517 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -3896,6 +3896,10 @@ leave:
//------------------------------------------------------------------
bool Blockchain::prune_blockchain(uint32_t pruning_seed)
{
+ m_tx_pool.lock();
+ epee::misc_utils::auto_scope_leave_caller unlocker = epee::misc_utils::create_scope_leave_handler([&](){m_tx_pool.unlock();});
+ CRITICAL_REGION_LOCAL(m_blockchain_lock);
+
return m_db->prune_blockchain(pruning_seed);
}
//------------------------------------------------------------------