code: func (sm *SyncManager) isSyncCandidate(peer *peerpkg.Peer) bool {
  	// Typically a peer is not a candidate for sync if it's not a full node,
  	// however regression test is special in that the regression tool is
  	// not a full node and still needs to be considered a sync candidate.
  	if sm.chainParams == &chaincfg.RegressionNetParams {
  		// The peer is not a candidate if it's not coming from localhost
  		// or the hostname can't be determined for some reason.
  		host, _, err := net.SplitHostPort(peer.Addr())
  		if err != nil {
  			return false
  		}
  
  		if host != "127.0.0.1" && host != "localhost" {
  			return false
  		}
  	} else {
  		// The peer is not a candidate for sync if it's not a full
  		// node. Additionally, if the segwit soft-fork package has
  		// activated, then the peer must also be upgraded.
  		segwitActive, err := sm.chain.IsDeploymentActive(chaincfg.DeploymentSegwit)
  		if err != nil {
  			log.Errorf("Unable to query for segwit "+
  				"soft-fork state: %v", err)
  		}
  		nodeServices := peer.Services()
  		if nodeServices&wire.SFNodeNetwork != wire.SFNodeNetwork ||
  			(segwitActive && !peer.IsWitnessEnabled()) {
  			return false
  		}
  	}
  
  	// Candidate if all checks passed.
  	return true
  }
docs: // isSyncCandidate returns whether or not the peer is a candidate to consider
  // syncing from.