Merge pull request #9755 from guggero/payment-bandwidth-funding-blob

htlcswitch+routing: add funding blob to PaymentBandwidth
This commit is contained in:
Oliver Gugger
2025-04-22 22:23:45 +02:00
committed by GitHub
3 changed files with 14 additions and 12 deletions

View File

@@ -512,11 +512,13 @@ type AuxTrafficShaper interface {
fundingBlob, htlcBlob fn.Option[tlv.Blob]) (bool, error) fundingBlob, htlcBlob fn.Option[tlv.Blob]) (bool, error)
// PaymentBandwidth returns the available bandwidth for a custom channel // PaymentBandwidth returns the available bandwidth for a custom channel
// decided by the given channel aux blob and HTLC blob. A return value // decided by the given channel funding/commitment aux blob and HTLC
// of 0 means there is no bandwidth available. To find out if a channel // blob. A return value of 0 means there is no bandwidth available. To
// is a custom channel that should be handled by the traffic shaper, the // find out if a channel is a custom channel that should be handled by
// ShouldHandleTraffic method should be called first. // the traffic shaper, the ShouldHandleTraffic method should be called
PaymentBandwidth(htlcBlob, commitmentBlob fn.Option[tlv.Blob], // first.
PaymentBandwidth(fundingBlob, htlcBlob,
commitmentBlob fn.Option[tlv.Blob],
linkBandwidth, htlcAmt lnwire.MilliSatoshi, linkBandwidth, htlcAmt lnwire.MilliSatoshi,
htlcView lnwallet.AuxHtlcView) (lnwire.MilliSatoshi, error) htlcView lnwallet.AuxHtlcView) (lnwire.MilliSatoshi, error)

View File

@@ -3504,7 +3504,7 @@ func (l *channelLink) AuxBandwidth(amount lnwire.MilliSatoshi,
// Ask for a specific bandwidth to be used for the channel. // Ask for a specific bandwidth to be used for the channel.
commitmentBlob := l.CommitmentCustomBlob() commitmentBlob := l.CommitmentCustomBlob()
auxBandwidth, err := ts.PaymentBandwidth( auxBandwidth, err := ts.PaymentBandwidth(
htlcBlob, commitmentBlob, l.Bandwidth(), amount, fundingBlob, htlcBlob, commitmentBlob, l.Bandwidth(), amount,
l.channel.FetchLatestAuxHTLCView(), l.channel.FetchLatestAuxHTLCView(),
) )
if err != nil { if err != nil {

View File

@@ -145,12 +145,12 @@ func (*mockTrafficShaper) ShouldHandleTraffic(_ lnwire.ShortChannelID,
return true, nil return true, nil
} }
// PaymentBandwidth returns the available bandwidth for a custom channel // PaymentBandwidth returns the available bandwidth for a custom channel decided
// decided by the given channel aux blob and HTLC blob. A return value // by the given channel funding/commitment aux blob and HTLC blob. A return
// of 0 means there is no bandwidth available. To find out if a channel // value of 0 means there is no bandwidth available. To find out if a channel is
// is a custom channel that should be handled by the traffic shaper, the // a custom channel that should be handled by the traffic shaper, the
// HandleTraffic method should be called first. // ShouldHandleTraffic method should be called first.
func (*mockTrafficShaper) PaymentBandwidth(_, _ fn.Option[tlv.Blob], func (*mockTrafficShaper) PaymentBandwidth(_, _, _ fn.Option[tlv.Blob],
linkBandwidth, _ lnwire.MilliSatoshi, linkBandwidth, _ lnwire.MilliSatoshi,
_ lnwallet.AuxHtlcView) (lnwire.MilliSatoshi, error) { _ lnwallet.AuxHtlcView) (lnwire.MilliSatoshi, error) {