invoices: enhance the unit test suite.
The invoiceregistry test suite also includes unit tests for multi part payment especially also including payments to AMP invoices.
This commit is contained in:
3 files changed
+375
-11
No files matched your search
@@ -207,7 +207,7 @@ func getCircuitKey(htlcID uint64) invpkg.CircuitKey {
|
||||
// Note that this invoice *does not* have a payment address set. It will
|
||||
// create a regular invoice with a preimage is hodl is false, and a hodl
|
||||
// invoice with no preimage otherwise.
|
||||
func newInvoice(t *testing.T, hodl bool) *invpkg.Invoice {
|
||||
func newInvoice(t *testing.T, hodl bool, ampInvoice bool) *invpkg.Invoice {
|
||||
invoice := &invpkg.Invoice{
|
||||
Terms: invpkg.ContractTerm{
|
||||
Value: testInvoiceAmount,
|
||||
@@ -217,6 +217,23 @@ func newInvoice(t *testing.T, hodl bool) *invpkg.Invoice {
|
||||
CreationDate: testInvoiceCreationDate,
|
||||
}
|
||||
|
||||
// This makes the invoice an AMP invoice. We do not support AMP hodl
|
||||
// invoices.
|
||||
if ampInvoice {
|
||||
ampFeature := lnwire.NewRawFeatureVector(
|
||||
lnwire.TLVOnionPayloadOptional,
|
||||
lnwire.PaymentAddrOptional,
|
||||
lnwire.AMPRequired,
|
||||
)
|
||||
|
||||
ampFeatures := lnwire.NewFeatureVector(
|
||||
ampFeature, lnwire.Features,
|
||||
)
|
||||
invoice.Terms.Features = ampFeatures
|
||||
|
||||
return invoice
|
||||
}
|
||||
|
||||
// If creating a hodl invoice, we don't include a preimage.
|
||||
if hodl {
|
||||
invoice.HodlInvoice = true
|
||||
|
||||
Reference in new issue
Block a user