mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 01:33:02 +01:00
htlcswitch: allow custom HTLCs to bypass the amt to fwrd check
As this is a exit hop HTLC, we'll rely on the decision from the invoice registry to decide if we should continue or not.
This commit is contained in:
parent
3b8a3fac10
commit
cd0e15fd73
@ -3566,13 +3566,20 @@ func (l *channelLink) processExitHop(pd *lnwallet.PaymentDescriptor,
|
||||
return nil
|
||||
}
|
||||
|
||||
// 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 pd.Amount < fwdInfo.AmountToForward {
|
||||
// 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.
|
||||
//
|
||||
// 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.
|
||||
hasBlindedPath := fwdInfo.NextBlinding.IsSome()
|
||||
customHTLC := pd.CustomRecords.IsSome() && !hasBlindedPath
|
||||
log.Infof("custom_htlc_bypass=%v", customHTLC)
|
||||
if !customHTLC && pd.Amount < fwdInfo.AmountToForward {
|
||||
l.log.Errorf("onion payload of incoming htlc(%x) has "+
|
||||
"incompatible value: expected <=%v, got %v", pd.RHash,
|
||||
pd.Amount, fwdInfo.AmountToForward)
|
||||
fwdInfo.AmountToForward, pd.Amount)
|
||||
|
||||
failure := NewLinkError(
|
||||
lnwire.NewFinalIncorrectHtlcAmount(pd.Amount),
|
||||
|
Loading…
x
Reference in New Issue
Block a user