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.
This commit is contained in:
Johan T. Halseth 2019-01-29 14:13:31 +01:00
parent 1863dcef1f
commit b593c1c7c7
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

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