mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-04-04 09:58:39 +02:00
lnwallet/channel: init localUpdateLog with index from remoteCommit,
remoteUpdateLog from localCommit This commit fixes a bug within channel.go that would lead to the content of the update logs and their indexes getting out of sync during restores. The scenario that could occur was that the localUpdateLog was initiated with a log index taken from the localCommitment. Updates we send (which are added to the localUpdateLog) will be added to the remote commitment first. The problem happened when an update was sent and added to the remote commitment, but not ACKed. Since it was not ACKed, we would not add it to our local commitment. During a restart/restore we would init the localUpdateLog with a height too low, such that when going through the outgoing HTLCs on the remote commitment, we would restore an HTLC at an index higher than our local log HTLC counter. The symmetric change is done to the remoteUpdateLog.
This commit is contained in:
parent
321cc69e4e
commit
902e1e77cb
@ -1340,10 +1340,10 @@ func NewLightningChannel(signer Signer, pCache PreimageCache,
|
||||
// First, initialize the update logs with their current counter values
|
||||
// from the local and remote commitments.
|
||||
localUpdateLog := newUpdateLog(
|
||||
localCommit.LocalLogIndex, localCommit.LocalHtlcIndex,
|
||||
remoteCommit.LocalLogIndex, remoteCommit.LocalHtlcIndex,
|
||||
)
|
||||
remoteUpdateLog := newUpdateLog(
|
||||
remoteCommit.RemoteLogIndex, remoteCommit.RemoteHtlcIndex,
|
||||
localCommit.RemoteLogIndex, localCommit.RemoteHtlcIndex,
|
||||
)
|
||||
|
||||
lc := &LightningChannel{
|
||||
|
Loading…
x
Reference in New Issue
Block a user