Fix blockchain_import wedge on exception in cleanup_handle_incoming_blocks

This commit is contained in:
moneromooo-monero 2017-08-29 15:43:32 +01:00
parent 84fa015e77
commit ce901fcb31
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
5 changed files with 47 additions and 15 deletions

View file

@ -3582,12 +3582,23 @@ void Blockchain::block_longhash_worker(uint64_t height, const std::vector<block>
//------------------------------------------------------------------
bool Blockchain::cleanup_handle_incoming_blocks(bool force_sync)
{
bool success = false;
MTRACE("Blockchain::" << __func__);
CRITICAL_REGION_BEGIN(m_blockchain_lock);
TIME_MEASURE_START(t1);
m_db->batch_stop();
if (m_sync_counter > 0)
try
{
m_db->batch_stop();
success = true;
}
catch (const std::exception &e)
{
MERROR("Exception in cleanup_handle_incoming_blocks: " << e.what());
}
if (success && m_sync_counter > 0)
{
if (force_sync)
{
@ -3622,7 +3633,7 @@ bool Blockchain::cleanup_handle_incoming_blocks(bool force_sync)
CRITICAL_REGION_END();
m_tx_pool.unlock();
return true;
return success;
}
//------------------------------------------------------------------