htlcswitch: allow sending htlcs when paying invoices with a zero amount

This commit is contained in:
Wilmer Paulino 2018-01-22 15:10:12 -05:00
parent 1570c0ece8
commit f0d6d31ca4
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

View File

@ -1469,7 +1469,15 @@ func (l *channelLink) processLockedInHtlcs(
// Otherwise, we settle this htlc within our
// local state update log, then send the update
// entry to the remote party.
if !l.cfg.DebugHTLC && pd.Amount < invoice.Terms.Value {
//
// NOTE: We make an exception when the value
// requested by the invoice is zero. This means
// the invoice allows the payee to specify the
// amount of satoshis they wish to send.
// So since we expect the htlc to have a
// different amount, we should not fail.
if !l.cfg.DebugHTLC && invoice.Terms.Value > 0 &&
pd.Amount < invoice.Terms.Value {
log.Errorf("rejecting htlc due to incorrect "+
"amount: expected %v, received %v",
invoice.Terms.Value, pd.Amount)
@ -1484,7 +1492,14 @@ func (l *channelLink) processLockedInHtlcs(
// ensure that it was crafted correctly by the
// sender and matches the HTLC we were
// extended.
if !l.cfg.DebugHTLC &&
//
// NOTE: We make an exception when the value
// requested by the invoice is zero. This means
// the invoice allows the payee to specify the
// amount of satoshis they wish to send.
// So since we expect the htlc to have a
// different amount, we should not fail.
if !l.cfg.DebugHTLC && invoice.Terms.Value > 0 &&
fwdInfo.AmountToForward != invoice.Terms.Value {
log.Errorf("Onion payload of incoming "+