Improve peer performance for NAT'd nodes (#5345)

* Merge latest unstable

* Reduce diff

* Reduce logic, discover up to max peers

* Peer discovery for Natd peers
This commit is contained in:
Age Manning 2024-03-07 23:32:30 +11:00 committed by GitHub
parent 84a902a589
commit de91c77cb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -880,8 +880,7 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
let outbound_only_peer_count = self.network_globals.connected_outbound_only_peers();
let wanted_peers = if peer_count < self.target_peers.saturating_sub(dialing_peers) {
// We need more peers in general.
// Note: The maximum discovery query is bounded by `Discovery`.
self.target_peers.saturating_sub(dialing_peers) - peer_count
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()
{