From 73eb37b3a9f0964b67d2888c0719d7ef26225832 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 9 Dec 2018 20:03:08 -0800 Subject: [PATCH] peer: don't attempt to load any channels that have a non-default state, other then recovered In this commit, we modify the filter we use to determine if we should add a new channel to the switch to reflect the new channel restoration state. For all other non-default states, we want to avoid loading in a channel, but for the restoration state, we need to load the link in order to ensure we initiate the data loss protection protocol once we connect to the remote peer. --- peer.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/peer.go b/peer.go index 4cdeed57..eb7cc434 100644 --- a/peer.go +++ b/peer.go @@ -438,7 +438,12 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error { // Skip adding any permanently irreconcilable channels to the // htlcswitch. - if dbChan.ChanStatus() != channeldb.ChanStatusDefault { + switch { + case dbChan.HasChanStatus(channeldb.ChanStatusBorked): + fallthrough + case dbChan.HasChanStatus(channeldb.ChanStatusCommitBroadcasted): + fallthrough + case dbChan.HasChanStatus(channeldb.ChanStatusLocalDataLoss): peerLog.Warnf("ChannelPoint(%v) has status %v, won't "+ "start.", chanPoint, dbChan.ChanStatus()) continue