diff options
author | NoodleDoodleNoodleDoodleNoodleDoodleNoo <NoodleDoodleNoodleDoodleNoodleDoodleNoo@users.noreply.github.com> | 2015-07-10 14:39:12 -0700 |
---|---|---|
committer | NoodleDoodleNoodleDoodleNoodleDoodleNoo <xeven77@outlook.com> | 2015-07-15 23:20:18 -0700 |
commit | 2b2ae367243413a56775572595e02c670eb6399b (patch) | |
tree | 4b44d6916ad2591fb2c6cd80370217f9373e22db /src/cryptonote_protocol | |
parent | ** CHANGES ARE EXPERIMENTAL (FOR TESTING ONLY) (diff) | |
download | monero-2b2ae367243413a56775572595e02c670eb6399b.tar.xz |
Pause miner before preparing for incoming blocks
Diffstat (limited to 'src/cryptonote_protocol')
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.inl | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index a269b54b8..4a046aa45 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -314,10 +314,10 @@ namespace cryptonote LOG_PRINT_CCONTEXT_L2("NOTIFY_NEW_BLOCK (hop " << arg.hop << ")"); if(context.m_state != cryptonote_connection_context::state_normal) return 1; - - std::list<block_complete_entry> blocks; - blocks.push_back(arg.b); - m_core.prepare_handle_incoming_blocks(blocks); + m_core.pause_mine(); + std::list<block_complete_entry> blocks; + blocks.push_back(arg.b); + m_core.prepare_handle_incoming_blocks(blocks); for(auto tx_blob_it = arg.b.txs.begin(); tx_blob_it!=arg.b.txs.end();tx_blob_it++) { cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc); @@ -327,13 +327,12 @@ namespace cryptonote LOG_PRINT_CCONTEXT_L1("Block verification failed: transaction verification failed, dropping connection"); m_p2p->drop_connection(context); m_core.cleanup_handle_incoming_blocks(); + m_core.resume_mine(); return 1; } } - block_verification_context bvc = boost::value_initialized<block_verification_context>(); - m_core.pause_mine(); m_core.handle_incoming_block(arg.b.block, bvc); // got block from handle_notify_new_block m_core.cleanup_handle_incoming_blocks(true); m_core.resume_mine(); |