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:
1 file changed
+4
@@ -235,6 +235,10 @@ func newPeer(conn net.Conn, connReq *connmgr.ConnReq, server *server,
|
|||||||
// channels returned by the database.
|
// channels returned by the database.
|
||||||
func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
|
func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
|
||||||
for _, dbChan := range chans {
|
for _, dbChan := range chans {
|
||||||
|
if dbChan.IsPending {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
chanID := dbChan.ChanID
|
chanID := dbChan.ChanID
|
||||||
lnChan, err := lnwallet.NewLightningChannel(p.server.lnwallet.Signer,
|
lnChan, err := lnwallet.NewLightningChannel(p.server.lnwallet.Signer,
|
||||||
p.server.chainNotifier, dbChan)
|
p.server.chainNotifier, dbChan)
|
||||||
|
|||||||
Reference in new issue
Block a user