lnwallet: pack htlcView.{OurUpdates|TheirUpdates} into Dual.

This commit moves the collection of updates behind a Dual structure.
This allows us in a later commit to index into it via a ChannelParty
parameter which will simplify the loops in evaluateHTLCView.
This commit is contained in:
Keagan McClelland committed 2024-10-14 09:33:38 -06:00
1 parent 1b2cb14254
commit 4b2a4e36ad
3 files changed
+44 -38

No files matched your search

+8 -5
View File
@@ -8941,9 +8941,11 @@ func TestEvaluateView(t *testing.T) {
}
view := &HtlcView{
OurUpdates: test.ourHtlcs,
TheirUpdates: test.theirHtlcs,
FeePerKw: feePerKw,
Updates: lntypes.Dual[[]*paymentDescriptor]{
Local: test.ourHtlcs,
Remote: test.theirHtlcs,
},
FeePerKw: feePerKw,
}
var (
@@ -8996,11 +8998,12 @@ func TestEvaluateView(t *testing.T) {
}
checkExpectedHtlcs(
t, result.OurUpdates, test.ourExpectedHtlcs,
t, result.Updates.Local, test.ourExpectedHtlcs,
)
checkExpectedHtlcs(
t, result.TheirUpdates, test.theirExpectedHtlcs,
t, result.Updates.Remote,
test.theirExpectedHtlcs,
)
if lc.channelState.TotalMSatSent != test.expectSent {