From cfa9e954c7c0026262553d15381a6180214ee383 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Wed, 24 Mar 2021 19:52:38 -0700 Subject: [PATCH] channeldb/invoice: allow creating AMP invoices w/o preiamge --- channeldb/invoices.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/channeldb/invoices.go b/channeldb/invoices.go index 2dcd1be8..fbec1a39 100644 --- a/channeldb/invoices.go +++ b/channeldb/invoices.go @@ -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") }