peer: don't load channels on connect that are still pending

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.
This commit is contained in:
Olaoluwa Osuntokun 2017-02-24 16:19:10 -08:00
parent 5cc0765b63
commit b5a6098dd5
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
1 changed files with 4 additions and 0 deletions

View File

@ -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)