Permalink
Browse files

Drop peer connection if there are many invalid block hashes

  • Loading branch information...
miltonf committed Dec 6, 2018
1 parent 437c7b4 commit 6cedea8f66b943bbb4a5cb63c36b59dfaedbb9fa
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -1626,10 +1626,10 @@ skip:
}

uint64_t n_use_blocks = m_core.prevalidate_block_hashes(arg.start_height, arg.m_block_ids);
if (n_use_blocks == 0)
if (n_use_blocks + HASH_OF_HASHES_STEP <= arg.m_block_ids.size())
{
LOG_ERROR_CCONTEXT("Peer yielded no usable blocks, dropping connection");
drop_connection(context, false, false);
LOG_ERROR_CCONTEXT("Most blocks are invalid");
drop_connection(context, true, false);
return 1;
}

0 comments on commit 6cedea8

Please sign in to comment.