Merge pull request #1725

53f04044 cryptonote_protocol: tweaks to the syncing speedup (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2017-02-21 11:26:47 +02:00
commit b67d35a76a
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
1 changed files with 10 additions and 6 deletions

View File

@ -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()); 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 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 // 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 // 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 // connections will wait until the current one's added its blocks, then
// will add any extra it has, if any // will add any extra it has, if any
CRITICAL_REGION_LOCAL(m_sync_lock); 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) // dismiss what another connection might already have done (likely everything)
uint64_t top_height; uint64_t top_height;
crypto::hash top_hash; crypto::hash top_hash;
@ -921,6 +921,9 @@ namespace cryptonote
} }
} }
if (arg.blocks.empty())
goto skip;
m_core.prepare_handle_incoming_blocks(arg.blocks); m_core.prepare_handle_incoming_blocks(arg.blocks);
for(const block_complete_entry& block_entry: arg.blocks) for(const block_complete_entry& block_entry: arg.blocks)
@ -986,6 +989,7 @@ namespace cryptonote
} }
skip:
request_missing_objects(context, true); request_missing_objects(context, true);
return 1; return 1;
} }