lnwallet: simplify fee calculation in evaluateHTLCView
This commit simplifies how we compute the commitment fee rate based off of the live updates. Prior to this commit we processed all of the FeeUpdate paymentDescriptors of both ChannelParty's. Now we only process the last FeeUpdate of the OpeningParty
This commit is contained in:
4 files changed
+23
-31
No files matched your search
@@ -8650,6 +8650,7 @@ func TestEvaluateView(t *testing.T) {
|
||||
name string
|
||||
ourHtlcs []*paymentDescriptor
|
||||
theirHtlcs []*paymentDescriptor
|
||||
channelInitiator lntypes.ChannelParty
|
||||
whoseCommitChain lntypes.ChannelParty
|
||||
mutateState bool
|
||||
|
||||
@@ -8679,6 +8680,7 @@ func TestEvaluateView(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "our fee update is applied",
|
||||
channelInitiator: lntypes.Local,
|
||||
whoseCommitChain: lntypes.Local,
|
||||
mutateState: false,
|
||||
ourHtlcs: []*paymentDescriptor{
|
||||
@@ -8696,6 +8698,7 @@ func TestEvaluateView(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "their fee update is applied",
|
||||
channelInitiator: lntypes.Remote,
|
||||
whoseCommitChain: lntypes.Local,
|
||||
mutateState: false,
|
||||
ourHtlcs: []*paymentDescriptor{},
|
||||
@@ -8911,8 +8914,10 @@ func TestEvaluateView(t *testing.T) {
|
||||
test := test
|
||||
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
isInitiator := test.channelInitiator == lntypes.Local
|
||||
lc := LightningChannel{
|
||||
channelState: &channeldb.OpenChannel{
|
||||
IsInitiator: isInitiator,
|
||||
TotalMSatSent: 0,
|
||||
TotalMSatReceived: 0,
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user