blockchain: lock the blockchain while pruning

This commit is contained in:
moneromooo-monero 2019-04-15 12:29:25 +00:00
parent 1f809e7485
commit bb0ef5b1f2
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 4 additions and 0 deletions

View File

@ -3896,6 +3896,10 @@ leave:
//------------------------------------------------------------------ //------------------------------------------------------------------
bool Blockchain::prune_blockchain(uint32_t pruning_seed) 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); return m_db->prune_blockchain(pruning_seed);
} }
//------------------------------------------------------------------ //------------------------------------------------------------------