From 11b84f5cb57a9edc1a86109344636b5598df192d Mon Sep 17 00:00:00 2001 From: Wilmer Paulino Date: Fri, 11 Oct 2019 18:17:21 -0400 Subject: [PATCH] server: signal SyncManager with new peer within AddPeer This makes the logic a bit more unified as previously it was possible we for us to report the new peer to the SyncManager, but for whatever reason failed to track the peer in the server internally within AddPeer. This change ensures this can no longer happen. --- server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server.go b/server.go index 9f4c54d3..17dc2783 100644 --- a/server.go +++ b/server.go @@ -490,9 +490,6 @@ func (sp *serverPeer) OnVersion(_ *peer.Peer, msg *wire.MsgVersion) *wire.MsgRej // the local clock to keep the network time in sync. sp.server.timeSource.AddTimeSample(sp.Addr(), msg.Timestamp) - // Signal the sync manager this peer is a new sync candidate. - sp.server.syncManager.NewPeer(sp.Peer) - // Choose whether or not to relay transactions before a filter command // is received. sp.setDisableRelayTx(msg.DisableRelayTx) @@ -1657,6 +1654,9 @@ func (s *server) handleAddPeerMsg(state *peerState, sp *serverPeer) bool { s.addrManager.Connected(sp.NA()) } + // Signal the sync manager this peer is a new sync candidate. + s.syncManager.NewPeer(sp.Peer) + return true }