Merge pull request #1741 from halseth/autopilot-no-dc
autopilot: check if already connected before returning error
This commit is contained in:
commit
c6318eb614
12
pilot.go
12
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())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user