From d1a2dd6bd03f7371c656095bd4e7773b0a05d6f0 Mon Sep 17 00:00:00 2001 From: George Tsagkarelis Date: Thu, 12 Sep 2024 14:39:51 +0200 Subject: [PATCH] routing: add htlcAmt to PaymentBandwidth method of TlvTrafficShaper This commit was added to the 0-19-staging branch recently and therefore didn't make it into a previous part yet. So it's unrelated to the changes in this part but is required for the whole custom channel saga. --- routing/bandwidth.go | 4 +++- routing/bandwidth_test.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/routing/bandwidth.go b/routing/bandwidth.go index a193c654a..3b80dadc7 100644 --- a/routing/bandwidth.go +++ b/routing/bandwidth.go @@ -47,7 +47,8 @@ type TlvTrafficShaper interface { // is a custom channel that should be handled by the traffic shaper, the // HandleTraffic method should be called first. PaymentBandwidth(htlcBlob, commitmentBlob fn.Option[tlv.Blob], - linkBandwidth lnwire.MilliSatoshi) (lnwire.MilliSatoshi, error) + linkBandwidth, + htlcAmt lnwire.MilliSatoshi) (lnwire.MilliSatoshi, error) } // AuxHtlcModifier is an interface that allows the sender to modify the outgoing @@ -191,6 +192,7 @@ func (b *bandwidthManager) getBandwidth(cid lnwire.ShortChannelID, commitmentBlob := link.CommitmentCustomBlob() auxBandwidth, err := ts.PaymentBandwidth( b.firstHopBlob, commitmentBlob, linkBandwidth, + amount, ) if err != nil { return bandwidthErr(fmt.Errorf("failed to get "+ diff --git a/routing/bandwidth_test.go b/routing/bandwidth_test.go index 4876f09c7..4872b5a7e 100644 --- a/routing/bandwidth_test.go +++ b/routing/bandwidth_test.go @@ -148,7 +148,7 @@ func (*mockTrafficShaper) ShouldHandleTraffic(_ lnwire.ShortChannelID, // is a custom channel that should be handled by the traffic shaper, the // HandleTraffic method should be called first. func (*mockTrafficShaper) PaymentBandwidth(_, _ fn.Option[tlv.Blob], - linkBandwidth lnwire.MilliSatoshi) (lnwire.MilliSatoshi, error) { + linkBandwidth, _ lnwire.MilliSatoshi) (lnwire.MilliSatoshi, error) { return linkBandwidth, nil }