mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
chanrestore: don't exit with an error if we're already connected to the peer
In this commit, we fix a bug in the existing logic for ConnectPeer that would cause an SCB restore to fail if we were already connected to the peer. To fix this, we now instead will just return with a success if we're already connected to the peer.
This commit is contained in:
parent
4b57fb199f
commit
71e080a2fb
@ -171,7 +171,16 @@ func (s *server) ConnectPeer(nodePub *btcec.PublicKey, addrs []net.Addr) error {
|
||||
// Attempt to connect to the peer using this full address. If
|
||||
// we're unable to connect to them, then we'll try the next
|
||||
// address in place of it.
|
||||
if err := s.ConnectToPeer(netAddr, true); err != nil {
|
||||
err := s.ConnectToPeer(netAddr, true)
|
||||
|
||||
// If we're already connected to this peer, then we don't
|
||||
// consider this an erorr, so we'll exit here.
|
||||
if _, ok := err.(*errPeerAlreadyConnected); ok {
|
||||
return nil
|
||||
|
||||
} else if err != nil {
|
||||
// Otherwise, something else happened, so we'll try the
|
||||
// next address.
|
||||
ltndLog.Errorf("unable to connect to %v to "+
|
||||
"complete SCB restore: %v", netAddr, err)
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user