mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 18:10:34 +01:00
lnwallet/channel: remove FeeUpdates when compacting logs
When compacting the update logs we remove any fee updates when they remove height is passed. We do this since we'll assume fee updates are added and removed at the same commit height, as they will apply for all commitments following the fee update.
This commit is contained in:
parent
480f43f1dc
commit
277949cb0e
@ -1211,6 +1211,9 @@ func compactLogs(ourLog, theirLog *updateLog,
|
||||
nextA = e.Next()
|
||||
|
||||
htlc := e.Value.(*PaymentDescriptor)
|
||||
|
||||
// We skip Adds, as they will be removed along with the
|
||||
// fail/settles below.
|
||||
if htlc.EntryType == Add {
|
||||
continue
|
||||
}
|
||||
@ -1229,6 +1232,16 @@ func compactLogs(ourLog, theirLog *updateLog,
|
||||
if remoteChainTail >= htlc.removeCommitHeightRemote &&
|
||||
localChainTail >= htlc.removeCommitHeightLocal {
|
||||
|
||||
// Fee updates have no parent htlcs, so we only
|
||||
// remove the update itself.
|
||||
if htlc.EntryType == FeeUpdate {
|
||||
logA.removeUpdate(htlc.LogIndex)
|
||||
continue
|
||||
}
|
||||
|
||||
// The other types (fail/settle) do have a
|
||||
// parent HTLC, so we'll remove that HTLC from
|
||||
// the other log.
|
||||
logA.removeUpdate(htlc.LogIndex)
|
||||
logB.removeHtlc(htlc.ParentIndex)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user