diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-11-23 11:15:04 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-03-05 11:58:13 +0000 |
commit | 238401d4e950dad6a243fb895027dd26d2992ee6 (patch) | |
tree | ace8c69b75f6e6db2d2bdad69456ce346348b48c /src/blockchain_utilities | |
parent | blockchain: avoid unneeded block copy (diff) | |
download | monero-238401d4e950dad6a243fb895027dd26d2992ee6.tar.xz |
core: avoid double parsing blocks after hoh
Diffstat (limited to 'src/blockchain_utilities')
-rw-r--r-- | src/blockchain_utilities/blockchain_import.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp index d2c2b1ea9..d7a88f935 100644 --- a/src/blockchain_utilities/blockchain_import.cpp +++ b/src/blockchain_utilities/blockchain_import.cpp @@ -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) { |