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.
This commit is contained in:
Wilmer Paulino 2019-10-11 18:17:21 -04:00
parent 07282a6656
commit 11b84f5cb5
No known key found for this signature in database
GPG key ID: 6DF57B9F9514972F

View file

@ -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
}