htlcswitch: override amount check on custom records
This commit is contained in:
1 file changed
+12
-1
+12
-1
@@ -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
|
// 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
|
// the HTLC to ensure that it was crafted correctly by the sender and
|
||||||
// is compatible with the HTLC we were extended.
|
// 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 "+
|
l.log.Errorf("onion payload of incoming htlc(%x) has "+
|
||||||
"incompatible value: expected <=%v, got %v",
|
"incompatible value: expected <=%v, got %v",
|
||||||
add.PaymentHash, add.Amount, fwdInfo.AmountToForward)
|
add.PaymentHash, add.Amount, fwdInfo.AmountToForward)
|
||||||
|
|||||||
Reference in new issue
Block a user