network: consider handshaked peers only when comparing with MinPeers

We don't know a lot about non-handshaked ones, so it's safer to try more
connection.
This commit is contained in:
Roman Khimov 2022-11-17 16:40:29 +03:00
parent f8949564c8
commit 6ba4afc977

View file

@ -409,7 +409,7 @@ func (s *Server) run() {
// "Optimal" number of peers. // "Optimal" number of peers.
optimalN = s.discovery.GetFanOut() * 2 optimalN = s.discovery.GetFanOut() * 2
// Real number of peers. // Real number of peers.
peerN = s.PeerCount() peerN = s.HandshakedPeersCount()
) )
if peerN < s.MinPeers { if peerN < s.MinPeers {