channeldb/invoice: allow creating AMP invoices w/o preiamge

This commit is contained in:
Conner Fromknecht committed 2021-04-07 12:08:35 -07:00
1 parent ea934e1be9
commit cfa9e954c7
1 file changed
+6 -1
+6 -1
View File
@@ -719,7 +719,12 @@ func validateInvoice(i *Invoice, paymentHash lntypes.Hash) error {
return err
}
if i.Terms.PaymentPreimage == nil && !i.HodlInvoice {
// AMP invoices and hodl invoices are allowed to have no preimage
// specified.
isAMP := i.Terms.Features.HasFeature(
lnwire.AMPOptional,
)
if i.Terms.PaymentPreimage == nil && !(i.HodlInvoice || isAMP) {
return errors.New("non-hodl invoices must have a preimage")
}