From 3067da20183329018853a140258b4c0733131595 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 11 Oct 2017 13:00:49 +0100 Subject: [PATCH] core: guard against a mined block not finding all txes in the pool This can happen for several reasons, but mainly if another block was received, which took that tx off the pool. --- src/cryptonote_core/cryptonote_core.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index c7863b816..51c512b5b 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1023,7 +1023,15 @@ namespace cryptonote block_verification_context bvc = boost::value_initialized(); m_miner.pause(); std::list blocks; - blocks.push_back(get_block_complete_entry(b, m_mempool)); + try + { + blocks.push_back(get_block_complete_entry(b, m_mempool)); + } + catch (const std::exception &e) + { + m_miner.resume(); + return false; + } prepare_handle_incoming_blocks(blocks); m_blockchain_storage.add_new_block(b, bvc); cleanup_handle_incoming_blocks(true);