Skip to content

Commit ac71fe9

Browse files
author
Antoine Riard
committed
[doc] Clarify scope of eviction protection of outbound block-relay peers
Block-relay-only peers were introduced by #15759. According to its author, it was intented to make them only immune to outbound peer rotation-based eviction and not from all eviction as modified comment leans to think of. Clearly indicate that outbound block-relay peers aren't protected from eviction by the bad/lagging chain logic.
1 parent a0a422c commit ac71fe9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/net_processing.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,11 +2018,12 @@ static void ProcessHeadersMessage(CNode& pfrom, CConnman& connman, ChainstateMan
20182018
}
20192019
}
20202020

2021+
// If this is an outbound full-relay peer, check to see if we should protect
2022+
// it from the bad/lagging chain logic.
2023+
// Note that outbound block-relay peers are excluded from this protection, and
2024+
// thus always subject to eviction under the bad/lagging chain logic.
2025+
// See ChainSyncTimeoutState.
20212026
if (!pfrom.fDisconnect && pfrom.IsFullOutboundConn() && nodestate->pindexBestKnownBlock != nullptr) {
2022-
// If this is an outbound full-relay peer, check to see if we should protect
2023-
// it from the bad/lagging chain logic.
2024-
// Note that block-relay-only peers are already implicitly protected, so we
2025-
// only consider setting m_protect for the full-relay peers.
20262027
if (g_outbound_peers_with_protect_from_disconnect < MAX_OUTBOUND_PEERS_TO_PROTECT_FROM_DISCONNECT && nodestate->pindexBestKnownBlock->nChainWork >= ::ChainActive().Tip()->nChainWork && !nodestate->m_chain_sync.m_protect) {
20272028
LogPrint(BCLog::NET, "Protecting outbound peer=%d from eviction\n", pfrom.GetId());
20282029
nodestate->m_chain_sync.m_protect = true;

0 commit comments

Comments
 (0)