aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-12-12 17:48:29 +0200
committerRiccardo Spagni <ric@spagni.net>2017-12-12 17:48:29 +0200
commit319163d276137c97f0d9d810902c0cf12b9af273 (patch)
tree6305d06e8f9d4885b2efd1ae803530771da2080e
parentMerge pull request #2906 (diff)
parentcryptonote_protocol: fix corner case looping asking for same block hashes (diff)
downloadmonero-319163d276137c97f0d9d810902c0cf12b9af273.tar.xz
Merge pull request #2913
b927f0b1 cryptonote_protocol: fix corner case looping asking for same block hashes (moneromooo-monero)
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index 9ae24551c..48ab1eadf 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -1414,6 +1414,10 @@ skip:
// take out blocks we already have
while (!context.m_needed_objects.empty() && m_core.have_block(context.m_needed_objects.front()))
{
+ // if we're popping the last hash, record it so we can ask again from that hash,
+ // this prevents never being able to progress on peers we get old hash lists from
+ if (context.m_needed_objects.size() == 1)
+ context.m_last_known_hash = context.m_needed_objects.front();
context.m_needed_objects.pop_front();
}
const uint64_t first_block_height = context.m_last_response_height - context.m_needed_objects.size() + 1;