core: avoid double parsing blocks after hoh

This commit is contained in:
moneromooo-monero
2018-11-23 11:15:04 +00:00
parent dc5a76095c
commit 238401d4e9
6 changed files with 50 additions and 25 deletions

View File

@@ -193,8 +193,16 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
}
core.prevalidate_block_hashes(core.get_blockchain_storage().get_db().height(), hashes);
core.prepare_handle_incoming_blocks(blocks);
std::vector<block> pblocks;
core.prepare_handle_incoming_blocks(blocks, pblocks);
if (!pblocks.empty() && pblocks.size() != blocks.size())
{
MERROR("Unexpected parsed blocks size");
core.cleanup_handle_incoming_blocks();
return 1;
}
size_t blockidx = 0;
for(const block_complete_entry& block_entry: blocks)
{
// process transactions
@@ -215,7 +223,7 @@ int check_flush(cryptonote::core &core, std::vector<block_complete_entry> &block
block_verification_context bvc = boost::value_initialized<block_verification_context>();
core.handle_incoming_block(block_entry.block, bvc, false); // <--- process block
core.handle_incoming_block(block_entry.block, pblocks.empty() ? NULL : &pblocks[blockidx++], bvc, false); // <--- process block
if(bvc.m_verifivation_failed)
{