From 0a821ed0854242e852b03f254ccf564437c2c790 Mon Sep 17 00:00:00 2001 From: Age Manning Date: Wed, 24 Jul 2024 15:04:46 +1000 Subject: [PATCH] Prevent continuous searchers for low-peer networks --- beacon_node/lighthouse_network/src/peer_manager/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/beacon_node/lighthouse_network/src/peer_manager/mod.rs b/beacon_node/lighthouse_network/src/peer_manager/mod.rs index d3d7b34eba8..9277f1f22a8 100644 --- a/beacon_node/lighthouse_network/src/peer_manager/mod.rs +++ b/beacon_node/lighthouse_network/src/peer_manager/mod.rs @@ -885,6 +885,11 @@ impl PeerManager { self.max_peers().saturating_sub(dialing_peers) - peer_count } else if outbound_only_peer_count < self.min_outbound_only_peers() && peer_count < self.max_outbound_dialing_peers() + && self.target_peers > 10 + // This condition is to attempt to exclude testnets without + // an explicit CLI flag. For networks with low peer counts, we don't want to do + // repetitive searches for outbound peers, when we may be already connected to every + // peer on the testnet { self.max_outbound_dialing_peers() .saturating_sub(dialing_peers)