Skip to content

Commit f04fa54

Browse files
Roasbeefguggero
authored andcommitted
routing: skip amtInRange for custom HTLCs
We might be trying to send an invoice amount that's greater than the size of the channel, but once you factor in the custom channel logic, an actual HTLC can be sent over the channel to pay that larger payment. As a result, we'll skip over this check if a have a custom HTLC.
1 parent 5b4de5f commit f04fa54

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

routing/unified_edges.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,13 @@ func (u *edgeUnifier) getEdgeLocal(netAmtReceived lnwire.MilliSatoshi,
247247
// local channel.
248248
amt := netAmtReceived + lnwire.MilliSatoshi(inboundFee)
249249

250-
// Check valid amount range for the channel.
251-
if !edge.amtInRange(amt) {
250+
// Check valid amount range for the channel. We skip this test
251+
// for payments with custom HTLC data, as the amount sent on
252+
// the BTC layer may differ from the amount that is actually
253+
// forwarded in custom channels.
254+
if bandwidthHints.firstHopCustomBlob().IsNone() &&
255+
!edge.amtInRange(amt) {
256+
252257
log.Debugf("Amount %v not in range for edge %v",
253258
netAmtReceived, edge.policy.ChannelID)
254259

0 commit comments

Comments
 (0)