Skip to content

Commit 6a0d859

Browse files
committed
htlcswitch: override amount check on custom records
1 parent 97c7ad9 commit 6a0d859

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

htlcswitch/link.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -3793,7 +3793,18 @@ func (l *channelLink) processExitHop(add lnwire.UpdateAddHTLC,
37933793
// As we're the exit hop, we'll double check the hop-payload included in
37943794
// the HTLC to ensure that it was crafted correctly by the sender and
37953795
// is compatible with the HTLC we were extended.
3796-
if add.Amount < fwdInfo.AmountToForward {
3796+
//
3797+
// For a special case, if the fwdInfo doesn't have any blinded path
3798+
// information, and the incoming HTLC had special extra data, then
3799+
// we'll skip this amount check. The invoice acceptor will make sure we
3800+
// reject the HTLC if it's not containing the correct amount after
3801+
// examining the custom data.
3802+
hasBlindedPath := fwdInfo.NextBlinding.IsSome()
3803+
customHTLC := len(add.CustomRecords) > 0 && !hasBlindedPath
3804+
log.Tracef("Exit hop has_blinded_path=%v custom_htlc_bypass=%v",
3805+
hasBlindedPath, customHTLC)
3806+
3807+
if !customHTLC && add.Amount < fwdInfo.AmountToForward {
37973808
l.log.Errorf("onion payload of incoming htlc(%x) has "+
37983809
"incompatible value: expected <=%v, got %v",
37993810
add.PaymentHash, add.Amount, fwdInfo.AmountToForward)

0 commit comments

Comments
 (0)