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.
This commit is contained in:
moneromooo-monero 2017-10-11 13:00:49 +01:00
parent 15b0ff2c32
commit 3067da2018
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3

View file

@ -1023,7 +1023,15 @@ namespace cryptonote
block_verification_context bvc = boost::value_initialized<block_verification_context>(); block_verification_context bvc = boost::value_initialized<block_verification_context>();
m_miner.pause(); m_miner.pause();
std::list<block_complete_entry> blocks; std::list<block_complete_entry> 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); prepare_handle_incoming_blocks(blocks);
m_blockchain_storage.add_new_block(b, bvc); m_blockchain_storage.add_new_block(b, bvc);
cleanup_handle_incoming_blocks(true); cleanup_handle_incoming_blocks(true);