Skip to content

Commit 5fb0f43

Browse files
committed
htlcswitch+routing: add htlc blob to ShouldHandleTraffic
Whether we should let the aux bandwidth manager decide what the bandwidth of a channel is should also depend on whether the HTLC is a custom HTLC, not just the channel.
1 parent cf0e0ff commit 5fb0f43

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

htlcswitch/interfaces.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ type AuxTrafficShaper interface {
509509
// identified by the provided channel ID may have external mechanisms
510510
// that would allow it to carry out the payment.
511511
ShouldHandleTraffic(cid lnwire.ShortChannelID,
512-
fundingBlob fn.Option[tlv.Blob]) (bool, error)
512+
fundingBlob, htlcBlob fn.Option[tlv.Blob]) (bool, error)
513513

514514
// PaymentBandwidth returns the available bandwidth for a custom channel
515515
// decided by the given channel aux blob and HTLC blob. A return value

htlcswitch/link.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3484,7 +3484,7 @@ func (l *channelLink) AuxBandwidth(amount lnwire.MilliSatoshi,
34843484
ts AuxTrafficShaper) fn.Result[OptionalBandwidth] {
34853485

34863486
fundingBlob := l.FundingCustomBlob()
3487-
shouldHandle, err := ts.ShouldHandleTraffic(cid, fundingBlob)
3487+
shouldHandle, err := ts.ShouldHandleTraffic(cid, fundingBlob, htlcBlob)
34883488
if err != nil {
34893489
return fn.Err[OptionalBandwidth](fmt.Errorf("traffic shaper "+
34903490
"failed to decide whether to handle traffic: %w", err))

routing/bandwidth_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ type mockTrafficShaper struct{}
140140
// by the provided channel ID may have external mechanisms that would
141141
// allow it to carry out the payment.
142142
func (*mockTrafficShaper) ShouldHandleTraffic(_ lnwire.ShortChannelID,
143-
_ fn.Option[tlv.Blob]) (bool, error) {
143+
_, _ fn.Option[tlv.Blob]) (bool, error) {
144144

145145
return true, nil
146146
}

0 commit comments

Comments
 (0)