peer: within loadActiveChannels, skip channel if FundingLocked not processed

This commit fixes a bug to wrap up the recently merged PR to properly
handle duplicate FundingLocked retransmissions and also ensure that we
reliably re-send the FundingLocked message if we’re unable to the first
time around.

In this commit, we skip processing a channel that does not yet have a
set remote revocation as otherwise, if we attempt to trigger a state
update, then we’ll be attempting to manipulate a nil commitment point.
Therefore, we’ll rely on the fundingManager to properly send the
channel all relevant subsystems.
This commit is contained in:
Olaoluwa Osuntokun 2017-10-02 16:30:17 -07:00
parent 4153712ba7
commit 171c997fe0
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

12
peer.go

@ -292,6 +292,18 @@ func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
}
chanPoint := &dbChan.FundingOutpoint
// If the channel we read form disk has a nil next revocation
// key, then we'll skip loading this channel. We must do this
// as it doesn't yet have the needed items required to initiate
// a local state transition, or one triggered by forwarding an
// HTLC.
if lnChan.RemoteNextRevocation() == nil {
peerLog.Debugf("Skipping ChannelPoint(%v), lacking "+
"next commit point", chanPoint)
continue
}
chanID := lnwire.NewChanIDFromOutPoint(chanPoint)
p.activeChanMtx.Lock()