Skip to content

Commit aea7673

Browse files
committed
htlcswitch: remove aux bandwidth check from canSendHtlc
We remove the aux bandwidth check from the helper canSendHtlc, which was called from CheckHTLCTransit and CheckHTLCForward (both are methods of the htlcswitch). For forwards we now fail at the link level, following the introduction of the AuxHtlcValidator. For payments, we now may fail either at the pathfinding level, or at the link level. The htlcswitch may no longer fail for aux bandwidth checks.
1 parent dbd5b4c commit aea7673

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

htlcswitch/link.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,40 +2605,6 @@ func (l *channelLink) canSendHtlc(policy models.ForwardingPolicy,
26052605
// forwarded.
26062606
availableBandwidth := l.Bandwidth()
26072607

2608-
auxBandwidth, externalErr := fn.MapOptionZ(
2609-
l.cfg.AuxTrafficShaper,
2610-
func(ts AuxTrafficShaper) fn.Result[OptionalBandwidth] {
2611-
var htlcBlob fn.Option[tlv.Blob]
2612-
blob, err := customRecords.Serialize()
2613-
if err != nil {
2614-
return fn.Err[OptionalBandwidth](
2615-
fmt.Errorf("unable to serialize "+
2616-
"custom records: %w", err))
2617-
}
2618-
2619-
if len(blob) > 0 {
2620-
htlcBlob = fn.Some(blob)
2621-
}
2622-
2623-
return l.AuxBandwidth(amt, originalScid, htlcBlob, ts)
2624-
},
2625-
).Unpack()
2626-
if externalErr != nil {
2627-
l.log.Errorf("Unable to determine aux bandwidth: %v",
2628-
externalErr)
2629-
2630-
return NewLinkError(&lnwire.FailTemporaryNodeFailure{})
2631-
}
2632-
2633-
if auxBandwidth.IsHandled && auxBandwidth.Bandwidth.IsSome() {
2634-
auxBandwidth.Bandwidth.WhenSome(
2635-
func(bandwidth lnwire.MilliSatoshi) {
2636-
availableBandwidth = bandwidth
2637-
},
2638-
)
2639-
}
2640-
2641-
// Check to see if there is enough balance in this channel.
26422608
if amt > availableBandwidth {
26432609
l.log.Warnf("insufficient bandwidth to route htlc: %v is "+
26442610
"larger than %v", amt, availableBandwidth)

0 commit comments

Comments
 (0)