aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol/cryptonote_protocol_handler.inl
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-02-13 19:36:31 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-02-13 19:36:31 +0000
commit53f040445fe08487116f092d309f27c7d4fa5dd3 (patch)
tree8a722cbc714207e383664e81cdb1b32c7716a891 /src/cryptonote_protocol/cryptonote_protocol_handler.inl
parentMerge pull request #1718 (diff)
downloadmonero-53f040445fe08487116f092d309f27c7d4fa5dd3.tar.xz
cryptonote_protocol: tweaks to the syncing speedup
- only pause mining once we've got the lock (in practice, it'll already be paused by another thread if we can't get the lock at once though) - do not call prepare_handle_incoming_blocks when we dismissed all the blocks, it only causes cleanup_handle_incoming_blocks to complain afterwards
Diffstat (limited to '')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index 72940d36a..7353b3124 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -888,22 +888,22 @@ namespace cryptonote
{
- m_core.pause_mine();
- epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler(
- boost::bind(&t_core::resume_mine, &m_core));
-
MLOG_YELLOW(el::Level::Debug, "Got NEW BLOCKS inside of " << __FUNCTION__ << ": size: " << arg.blocks.size());
if (m_core.get_test_drop_download() && m_core.get_test_drop_download_height()) { // DISCARD BLOCKS for testing
- uint64_t previous_height = m_core.get_current_blockchain_height();
-
// we lock all the rest to avoid having multiple connections redo a lot
// of the same work, and one of them doing it for nothing: subsequent
// connections will wait until the current one's added its blocks, then
// will add any extra it has, if any
CRITICAL_REGION_LOCAL(m_sync_lock);
+ m_core.pause_mine();
+ epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler(
+ boost::bind(&t_core::resume_mine, &m_core));
+
+ const uint64_t previous_height = m_core.get_current_blockchain_height();
+
// dismiss what another connection might already have done (likely everything)
uint64_t top_height;
crypto::hash top_hash;
@@ -921,6 +921,9 @@ namespace cryptonote
}
}
+ if (arg.blocks.empty())
+ goto skip;
+
m_core.prepare_handle_incoming_blocks(arg.blocks);
for(const block_complete_entry& block_entry: arg.blocks)
@@ -986,6 +989,7 @@ namespace cryptonote
}
+skip:
request_missing_objects(context, true);
return 1;
}