aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_protocol
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-09-25 17:01:53 +0200
committerRiccardo Spagni <ric@spagni.net>2017-09-25 17:01:53 +0200
commit74c4f1a5638f51c4b0ce8889de91f9ced0ab33a3 (patch)
tree7f9acec7c3fbd1bb5a24873dd5c35a7f579b90f1 /src/cryptonote_protocol
parentMerge pull request #2458 (diff)
parentcryptonote_protocol: fix needless chain hashes downloads (diff)
downloadmonero-74c4f1a5638f51c4b0ce8889de91f9ced0ab33a3.tar.xz
Merge pull request #2460
3487d810 cryptonote_protocol: fix needless chain hashes downloads (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_protocol')
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index 4626776a6..22cfb2299 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -931,7 +931,8 @@ namespace cryptonote
}
// get the last parsed block, which should be the highest one
- if(m_core.have_block(cryptonote::get_block_hash(b)))
+ const crypto::hash last_block_hash = cryptonote::get_block_hash(b);
+ if(m_core.have_block(last_block_hash))
{
const uint64_t subchain_height = start_height + arg.blocks.size();
LOG_DEBUG_CC(context, "These are old blocks, ignoring: blocks " << start_height << " - " << (subchain_height-1) << ", blockchain height " << m_core.get_current_blockchain_height());
@@ -949,7 +950,7 @@ namespace cryptonote
MDEBUG(context << " adding span: " << arg.blocks.size() << " at height " << start_height << ", " << dt.total_microseconds()/1e6 << " seconds, " << (rate/1e3) << " kB/s, size now " << (m_block_queue.get_data_size() + blocks_size) / 1048576.f << " MB");
m_block_queue.add_blocks(start_height, arg.blocks, context.m_connection_id, rate, blocks_size);
- context.m_last_known_hash = cryptonote::get_blob_hash(arg.blocks.back().block);
+ context.m_last_known_hash = last_block_hash;
if (!m_core.get_test_drop_download() || !m_core.get_test_drop_download_height()) { // DISCARD BLOCKS for testing
return 1;