diff --git a/pilot.go b/pilot.go index 86093a6f..c77237a8 100644 --- a/pilot.go +++ b/pilot.go @@ -109,12 +109,6 @@ func initAutoPilot(svr *server, cfg *autoPilotConfig) (*autopilot.Agent, error) Graph: autopilot.ChannelGraphFromDatabase(svr.chanDB.ChannelGraph()), MaxPendingOpens: 10, ConnectToPeer: func(target *btcec.PublicKey, addrs []net.Addr) (bool, error) { - // We can't establish a channel if no addresses were - // provided for the peer. - if len(addrs) == 0 { - return false, errors.New("no addresses specified") - } - // First, we'll check if we're already connected to the // target peer. If we are, we can exit early. Otherwise, // we'll need to establish a connection. @@ -122,6 +116,12 @@ func initAutoPilot(svr *server, cfg *autoPilotConfig) (*autopilot.Agent, error) return true, nil } + // We can't establish a channel if no addresses were + // provided for the peer. + if len(addrs) == 0 { + return false, errors.New("no addresses specified") + } + atplLog.Tracef("Attempting to connect to %x", target.SerializeCompressed())