From b5a6098dd5ecd3652ab76caab132cc89e470b689 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 24 Feb 2017 16:19:10 -0800 Subject: [PATCH] peer: don't load channels on connect that are still pending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit modifies the peer struct’s loadActiveChannels method to ensure that it skips over channels that aren’t actually active. This fixes a bug that could possibly cause a peer to get stuck in a circular wait loop and also de-sync a channel’s state machine. --- peer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/peer.go b/peer.go index d40ef3db9..8208ca2e7 100644 --- a/peer.go +++ b/peer.go @@ -235,6 +235,10 @@ func newPeer(conn net.Conn, connReq *connmgr.ConnReq, server *server, // channels returned by the database. func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error { for _, dbChan := range chans { + if dbChan.IsPending { + continue + } + chanID := dbChan.ChanID lnChan, err := lnwallet.NewLightningChannel(p.server.lnwallet.Signer, p.server.chainNotifier, dbChan)