From b593c1c7c72a6574c7cd4ae7be3c2d9a48160c3c Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 29 Jan 2019 14:13:31 +0100 Subject: [PATCH] lnwallet/channel: set logIndex for restored FeeUpdate Earlier versions did not write the log index to disk for fee updates, so they will be unset. To account for this we set them to to current update log index. --- lnwallet/channel.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 9ed768e1d..ed1b1a18b 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -1804,6 +1804,18 @@ func (lc *LightningChannel) restoreStateLogs( return err } + // Earlier versions did not write the log index to disk for fee + // updates, so they will be unset. To account for this we set + // them to to current update log index. + if payDesc.EntryType == FeeUpdate && payDesc.LogIndex == 0 && + lc.localUpdateLog.logIndex > 0 { + + payDesc.LogIndex = lc.localUpdateLog.logIndex + walletLog.Debugf("Found FeeUpdate on "+ + "pendingRemoteCommitDiff without logIndex, "+ + "using %v", payDesc.LogIndex) + } + switch payDesc.EntryType { case Add: // The HtlcIndex of the added HTLC _must_ be equal to