mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 18:10:34 +01:00
lnwallet/channel: remove restoreHtlc from pendingRemoteCommit
This commit removes the stage during updateLog restoration where we would attempt to restore incoming HLTCs from the pendingRemoteCommit, in addition to update our log and htlc counter to reflect this state. The reason we can safely remove this is to observe that a pending remote commit is always created from a commitDiff which only contains updates made by _us_, and thus only taken from the localUpdateLog. The same can be said for the counters, when creating a commitDiff we'll always use the remoteACKedIndex as the index into the remoteUpdateLog, meaning that all potential updates will already be included in the remote commit that has been ACKed.
This commit is contained in:
parent
fad7821e45
commit
c1e96e01e6
@ -1724,22 +1724,6 @@ func (lc *LightningChannel) restoreStateLogs(
|
||||
return nil
|
||||
}
|
||||
|
||||
// If we do have a dangling commitment for the remote party, then we'll
|
||||
// also restore into the log any incoming HTLC's offered by them. Any
|
||||
// outgoing HTLC's that were initially committed in this new state will
|
||||
// be restored below.
|
||||
for i := range pendingRemoteCommit.incomingHTLCs {
|
||||
htlc := pendingRemoteCommit.incomingHTLCs[i]
|
||||
lc.remoteUpdateLog.restoreHtlc(&htlc)
|
||||
}
|
||||
|
||||
// We'll also update the log counters to match the latest known
|
||||
// counters in this dangling commitment. Otherwise, our updateLog would
|
||||
// have dated counters as it was initially created using their lowest
|
||||
// unrevoked commitment.
|
||||
lc.remoteUpdateLog.logIndex = pendingRemoteCommit.theirMessageIndex
|
||||
lc.remoteUpdateLog.htlcCounter = pendingRemoteCommit.theirHtlcIndex
|
||||
|
||||
pendingCommit := pendingRemoteCommitDiff.Commitment
|
||||
pendingHeight := pendingCommit.CommitHeight
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user