From 65f0fadddbcfdf4ae2750f6c34346e05edb23db1 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 14 Oct 2022 10:16:50 +0300 Subject: [PATCH] network: register peer only if it's not a duplicate --- pkg/network/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/server.go b/pkg/network/server.go index 888bc44b4..6bef2c817 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -670,7 +670,6 @@ func (s *Server) handleVersionCmd(p Peer, version *payload.Version) error { return errInvalidNetwork } peerAddr := p.PeerAddr().String() - s.discovery.RegisterConnectedAddr(peerAddr) s.lock.RLock() for peer := range s.peers { if p == peer { @@ -684,6 +683,7 @@ func (s *Server) handleVersionCmd(p Peer, version *payload.Version) error { } } s.lock.RUnlock() + s.discovery.RegisterConnectedAddr(peerAddr) return p.SendVersionAck(NewMessage(CMDVerack, payload.NewNullPayload())) }