lnwallet: change bool isIncoming to new lntypes.ChannelParty

This commit removes another raw boolean value and replaces it with
a more clear type/name. This will also assist us when we later try
and consolidate the logic of evaluateHTLCView into a single
coherent computation.
This commit is contained in:
Keagan McClelland committed 2024-10-14 09:33:38 -06:00
1 parent b902d0825d
commit 1b2cb14254
2 files changed
+32 -27

No files matched your search

+16 -16
View File
@@ -9089,7 +9089,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
name string
startHeights heights
whoseCommitChain lntypes.ChannelParty
isIncoming bool
originator lntypes.ChannelParty
mutateState bool
ourExpectedBalance lnwire.MilliSatoshi
theirExpectedBalance lnwire.MilliSatoshi
@@ -9105,7 +9105,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Remote,
isIncoming: false,
originator: lntypes.Local,
mutateState: false,
ourExpectedBalance: startBalance,
theirExpectedBalance: startBalance,
@@ -9126,7 +9126,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Local,
isIncoming: false,
originator: lntypes.Local,
mutateState: false,
ourExpectedBalance: startBalance,
theirExpectedBalance: startBalance,
@@ -9147,7 +9147,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Local,
isIncoming: true,
originator: lntypes.Remote,
mutateState: false,
ourExpectedBalance: startBalance,
theirExpectedBalance: startBalance - updateAmount,
@@ -9168,7 +9168,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Local,
isIncoming: true,
originator: lntypes.Remote,
mutateState: true,
ourExpectedBalance: startBalance,
theirExpectedBalance: startBalance - updateAmount,
@@ -9190,7 +9190,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Remote,
isIncoming: false,
originator: lntypes.Local,
mutateState: false,
ourExpectedBalance: startBalance - updateAmount,
theirExpectedBalance: startBalance,
@@ -9211,7 +9211,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Remote,
isIncoming: false,
originator: lntypes.Local,
mutateState: true,
ourExpectedBalance: startBalance - updateAmount,
theirExpectedBalance: startBalance,
@@ -9232,7 +9232,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: removeHeight,
},
whoseCommitChain: lntypes.Remote,
isIncoming: false,
originator: lntypes.Local,
mutateState: false,
ourExpectedBalance: startBalance,
theirExpectedBalance: startBalance,
@@ -9253,7 +9253,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Local,
isIncoming: false,
originator: lntypes.Local,
mutateState: false,
ourExpectedBalance: startBalance,
theirExpectedBalance: startBalance,
@@ -9276,7 +9276,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Remote,
isIncoming: true,
originator: lntypes.Remote,
mutateState: false,
ourExpectedBalance: startBalance + updateAmount,
theirExpectedBalance: startBalance,
@@ -9299,7 +9299,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Remote,
isIncoming: false,
originator: lntypes.Local,
mutateState: false,
ourExpectedBalance: startBalance,
theirExpectedBalance: startBalance + updateAmount,
@@ -9322,7 +9322,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Remote,
isIncoming: true,
originator: lntypes.Remote,
mutateState: false,
ourExpectedBalance: startBalance,
theirExpectedBalance: startBalance + updateAmount,
@@ -9345,7 +9345,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Remote,
isIncoming: false,
originator: lntypes.Local,
mutateState: false,
ourExpectedBalance: startBalance + updateAmount,
theirExpectedBalance: startBalance,
@@ -9370,7 +9370,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Local,
isIncoming: true,
originator: lntypes.Remote,
mutateState: true,
ourExpectedBalance: startBalance + updateAmount,
theirExpectedBalance: startBalance,
@@ -9395,7 +9395,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
remoteRemove: 0,
},
whoseCommitChain: lntypes.Remote,
isIncoming: true,
originator: lntypes.Remote,
mutateState: true,
ourExpectedBalance: startBalance + updateAmount,
theirExpectedBalance: startBalance,
@@ -9450,7 +9450,7 @@ func TestProcessAddRemoveEntry(t *testing.T) {
if heightDual.GetForParty(test.whoseCommitChain) == 0 {
process(
update, &ourBalance, &theirBalance,
test.isIncoming,
test.originator,
)
if test.mutateState {