mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
htlcswitch: override amount check on custom records
This commit is contained in:
parent
cdc3a4a6c6
commit
52e50d807d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user