lnwallet: replace HtlcView with AuxHtlcView in existing code

This commit is contained in:
George Tsagkarelis
2025-04-14 15:32:34 +02:00
parent b96d57e88f
commit a279058408

View File

@@ -133,7 +133,7 @@ type CommitDiffAuxInput struct {
// UnfilteredView is the unfiltered, original HTLC view of the channel. // UnfilteredView is the unfiltered, original HTLC view of the channel.
// Unfiltered in this context means that the view contains all HTLCs, // Unfiltered in this context means that the view contains all HTLCs,
// including the canceled ones. // including the canceled ones.
UnfilteredView *HtlcView UnfilteredView AuxHtlcView
// WhoseCommit denotes whose commitment transaction we are computing the // WhoseCommit denotes whose commitment transaction we are computing the
// diff for. // diff for.
@@ -177,9 +177,8 @@ type AuxLeafStore interface {
// correspond to the passed aux blob, and an existing channel // correspond to the passed aux blob, and an existing channel
// commitment. // commitment.
FetchLeavesFromCommit(chanState AuxChanState, FetchLeavesFromCommit(chanState AuxChanState,
commit channeldb.ChannelCommitment, commit channeldb.ChannelCommitment, keyRing CommitmentKeyRing,
keyRing CommitmentKeyRing, whoseCommit lntypes.ChannelParty, whoseCommit lntypes.ChannelParty) fn.Result[CommitDiffAuxResult]
) fn.Result[CommitDiffAuxResult]
// FetchLeavesFromRevocation attempts to fetch the auxiliary leaves // FetchLeavesFromRevocation attempts to fetch the auxiliary leaves
// from a channel revocation that stores balance + blob information. // from a channel revocation that stores balance + blob information.
@@ -206,7 +205,7 @@ func auxLeavesFromView(leafStore AuxLeafStore, chanState *channeldb.OpenChannel,
return leafStore.FetchLeavesFromView(CommitDiffAuxInput{ return leafStore.FetchLeavesFromView(CommitDiffAuxInput{
ChannelState: NewAuxChanState(chanState), ChannelState: NewAuxChanState(chanState),
PrevBlob: blob, PrevBlob: blob,
UnfilteredView: originalView, UnfilteredView: newAuxHtlcView(originalView),
WhoseCommit: whoseCommit, WhoseCommit: whoseCommit,
OurBalance: ourBalance, OurBalance: ourBalance,
TheirBalance: theirBalance, TheirBalance: theirBalance,
@@ -227,13 +226,15 @@ func updateAuxBlob(leafStore AuxLeafStore, chanState *channeldb.OpenChannel,
return fn.MapOptionZ( return fn.MapOptionZ(
prevBlob, func(blob tlv.Blob) fn.Result[fn.Option[tlv.Blob]] { prevBlob, func(blob tlv.Blob) fn.Result[fn.Option[tlv.Blob]] {
return leafStore.ApplyHtlcView(CommitDiffAuxInput{ return leafStore.ApplyHtlcView(CommitDiffAuxInput{
ChannelState: NewAuxChanState(chanState), ChannelState: NewAuxChanState(chanState),
PrevBlob: blob, PrevBlob: blob,
UnfilteredView: nextViewUnfiltered, UnfilteredView: newAuxHtlcView(
WhoseCommit: whoseCommit, nextViewUnfiltered,
OurBalance: ourBalance, ),
TheirBalance: theirBalance, WhoseCommit: whoseCommit,
KeyRing: keyRing, OurBalance: ourBalance,
TheirBalance: theirBalance,
KeyRing: keyRing,
}) })
}, },
) )