mirror of
https://github.com/monero-project/monero.git
synced 2024-12-23 20:19:34 +00:00
cryptonote_protocol: drop peers we can't download from when syncing
Any peer that's behind us while syncing is useless to us (though not to them). This ensures that we don't get our peer slots filled with peers that we can't use. Once we've synced, we can connect to them and they can then sync off us if they want.
This commit is contained in:
parent
ff42af873c
commit
1542d5d978
1 changed files with 5 additions and 0 deletions
|
@ -341,6 +341,11 @@ namespace cryptonote
|
||||||
|
|
||||||
if(m_core.have_block(hshd.top_id))
|
if(m_core.have_block(hshd.top_id))
|
||||||
{
|
{
|
||||||
|
if (target > hshd.current_height)
|
||||||
|
{
|
||||||
|
MINFO(context << "peer is not ahead of us and we're syncing, disconnecting");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
context.m_state = cryptonote_connection_context::state_normal;
|
context.m_state = cryptonote_connection_context::state_normal;
|
||||||
if(is_inital && target == m_core.get_current_blockchain_height())
|
if(is_inital && target == m_core.get_current_blockchain_height())
|
||||||
on_connection_synchronized();
|
on_connection_synchronized();
|
||||||
|
|
Loading…
Reference in a new issue