We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6bae737 commit d5b78aaCopy full SHA for d5b78aa
netsync/manager.go
@@ -590,10 +590,17 @@ func (sm *SyncManager) handleNewPeerMsg(peer *peerpkg.Peer) {
590
return
591
}
592
593
- log.Infof("New valid peer %s (%s)", peer, peer.UserAgent())
594
-
595
// Initialize the peer state.
596
isSyncCandidate := sm.isSyncCandidate(peer)
+ if !sm.current() && !isSyncCandidate {
+ log.Infof("New peer %s (%s) is not a valid sync candidate -- disconnecting",
597
+ peer, peer.UserAgent())
598
+ peer.Disconnect()
599
+ return
600
+ }
601
+
602
+ log.Infof("New valid peer %s (%s)", peer, peer.UserAgent())
603
604
sm.peerStates[peer] = &peerSyncState{
605
syncCandidate: isSyncCandidate,
606
requestedTxns: make(map[chainhash.Hash]struct{}),
0 commit comments