From 31336f91b031254cc6b025ad230caf4fbf5709f1 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 14 Oct 2021 18:46:04 +0200 Subject: [PATCH] invoices: update testSpontaneousAmpPayment for new AMP logic Rather than checking the AMP invoice state itself, we'll instead check the HTLC state. --- invoices/invoiceregistry_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/invoices/invoiceregistry_test.go b/invoices/invoiceregistry_test.go index a75737787..b968fe073 100644 --- a/invoices/invoiceregistry_test.go +++ b/invoices/invoiceregistry_test.go @@ -176,7 +176,8 @@ func TestSettleInvoice(t *testing.T) { t.Fatal(err) } if inv.AmtPaid != amtPaid+amtPaid+600 { - t.Fatal("amount incorrect") + t.Fatalf("amount incorrect: expected %v got %v", + amtPaid+amtPaid+600, inv.AmtPaid) } // Try to cancel. @@ -1641,7 +1642,12 @@ func testSpontaneousAmpPayment( checkSettleSubscription := func() { t.Helper() settledInvoice := <-allSubscriptions.SettledInvoices - require.Equal(t, settledInvoice.State, channeldb.ContractSettled) + + // Since this is an AMP invoice, the invoice state never + // changes, but the AMP state should show that the setID has + // been settled. + htlcState := settledInvoice.AMPState[setID].State + require.Equal(t, htlcState, channeldb.HtlcStateSettled) } // Asserts that no invoice is published on the SettledInvoices channel