diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2020-09-03 10:41:02 -0400 |
---|---|---|
committer | Suhas Daftuar <sdaftuar@gmail.com> | 2020-12-10 08:46:51 -0500 |
commit | b3a515c0bec97633a76bec101af47c3c90c0b749 (patch) | |
tree | 086c9262fb0edaeb24d6033c72c7487d11b58f47 /src | |
parent | daffaf03fbede6c01287779e464379ee3acb005a (diff) | |
download | bitcoin-b3a515c0bec97633a76bec101af47c3c90c0b749.tar.xz |
Clarify comments around outbound peer eviction
Diffstat (limited to 'src')
-rw-r--r-- | src/net_processing.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 7dee2db3c8..200c286f5d 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -3953,10 +3953,10 @@ void PeerManager::EvictExtraOutboundPeers(int64_t time_in_seconds) }); } - // Check whether we have too many outbound peers + // Check whether we have too many OUTBOUND_FULL_RELAY peers if (m_connman.GetExtraFullOutboundCount() > 0) { - // If we have more outbound peers than we target, disconnect one. - // Pick the outbound peer that least recently announced + // If we have more OUTBOUND_FULL_RELAY peers than we target, disconnect one. + // Pick the OUTBOUND_FULL_RELAY peer that least recently announced // us a new block, with ties broken by choosing the more recent // connection (higher node id) NodeId worst_peer = -1; @@ -3965,7 +3965,8 @@ void PeerManager::EvictExtraOutboundPeers(int64_t time_in_seconds) m_connman.ForEachNode([&](CNode* pnode) EXCLUSIVE_LOCKS_REQUIRED(::cs_main) { AssertLockHeld(::cs_main); - // Ignore non-outbound peers, or nodes marked for disconnect already + // Only consider OUTBOUND_FULL_RELAY peers that are not already + // marked for disconnection if (!pnode->IsFullOutboundConn() || pnode->fDisconnect) return; CNodeState *state = State(pnode->GetId()); if (state == nullptr) return; // shouldn't be possible, but just in case |