htlcswitch: override amount check on custom records

This commit is contained in:
Oliver Gugger 2024-05-23 13:26:32 +02:00
parent cdc3a4a6c6
commit 52e50d807d
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

View File

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