From a0e757a104a014c608439b26f72705005707b95f Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 2 Jan 2021 18:28:09 +0000 Subject: [PATCH] protocol: handle receiving a block hash we've not added yet --- .../cryptonote_protocol_handler.inl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index 0dd290e8e..218c3c80e 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -2593,11 +2593,16 @@ skip: } int where; const bool have_block = m_core.have_block_unlocked(arg.m_block_ids[i], &where); - if (first && !have_block) + if (first) { - LOG_ERROR_CCONTEXT("First block hash is unknown, dropping connection"); - drop_connection_with_score(context, 5, false); - return 1; + if (!have_block && !m_block_queue.requested(arg.m_block_ids[i]) && !m_block_queue.have(arg.m_block_ids[i])) + { + LOG_ERROR_CCONTEXT("First block hash is unknown, dropping connection"); + drop_connection_with_score(context, 5, false); + return 1; + } + if (!have_block) + expect_unknown = true; } if (!first) {