lnwallet: use tail() instead of tip() in getUnsignedAckedUpdates

The previous behavior would allow updates to be overwritten in some
scenarios. Upon restart, this would lead to a missing settle/fail in
the update logs.
This commit is contained in:
eugene 2021-04-21 17:37:50 -04:00
parent 97007fc4fa
commit 7da2080a3d
No known key found for this signature in database
GPG Key ID: 118759E83439A9B1

@ -3260,7 +3260,7 @@ func (lc *LightningChannel) getUnsignedAckedUpdates() []channeldb.LogUpdate {
chanID := lnwire.NewChanIDFromOutPoint(&lc.channelState.FundingOutpoint) chanID := lnwire.NewChanIDFromOutPoint(&lc.channelState.FundingOutpoint)
// Fetch the last remote update that we have signed for. // Fetch the last remote update that we have signed for.
lastRemoteCommitted := lc.remoteCommitChain.tip().theirMessageIndex lastRemoteCommitted := lc.remoteCommitChain.tail().theirMessageIndex
// Fetch the last remote update that we have acked. // Fetch the last remote update that we have acked.
lastLocalCommitted := lc.localCommitChain.tail().theirMessageIndex lastLocalCommitted := lc.localCommitChain.tail().theirMessageIndex