cryptonote_protocol: drop connection when find_blockchain_supplement fails

This will be when we can't find common ground between the peer's
short chain history and our blockchain.

This fixes bad peers claiming a higher blockchain height from never
dropped, and keeping the node in synchronizing state forever, since
we will never get blocks from that peer.
This commit is contained in:
moneromooo-monero 2016-11-09 10:52:29 +00:00
parent e8a55db29d
commit 5c4cb96cfb
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 1 additions and 0 deletions

View File

@ -622,6 +622,7 @@ namespace cryptonote
if(!m_core.find_blockchain_supplement(arg.block_ids, r)) if(!m_core.find_blockchain_supplement(arg.block_ids, r))
{ {
LOG_ERROR_CCONTEXT("Failed to handle NOTIFY_REQUEST_CHAIN."); LOG_ERROR_CCONTEXT("Failed to handle NOTIFY_REQUEST_CHAIN.");
m_p2p->drop_connection(context);
return 1; return 1;
} }
LOG_PRINT_CCONTEXT_L2("-->>NOTIFY_RESPONSE_CHAIN_ENTRY: m_start_height=" << r.start_height << ", m_total_height=" << r.total_height << ", m_block_ids.size()=" << r.m_block_ids.size()); LOG_PRINT_CCONTEXT_L2("-->>NOTIFY_RESPONSE_CHAIN_ENTRY: m_start_height=" << r.start_height << ", m_total_height=" << r.total_height << ", m_block_ids.size()=" << r.m_block_ids.size());