Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/release-notes/release-notes-0.14.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ you.

* [Fixed restore backup file test flake with bitcoind](https://github.com/lightningnetwork/lnd/pull/5637).

* [Timing fix in AMP itest](https://github.com/lightningnetwork/lnd/pull/5725)

## Database

* [Ensure single writer for legacy
Expand Down
16 changes: 9 additions & 7 deletions lntest/itest/lnd_amp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ func testSendPaymentAMPInvoiceCase(net *lntest.NetworkHarness, t *harnessTest,
ctx := newMppTestContext(t, net)
defer ctx.shutdownNodes()

// Subscribe to bob's invoices. Do this early in the test to make sure
// that the subscription has actually been completed when we add an
// invoice. Otherwise the notification will be missed.
req := &lnrpc.InvoiceSubscription{}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I belive we could fix this below in testSendToRouteAMP too.

Copy link
Copy Markdown
Contributor Author

@joostjager joostjager Sep 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that one has sufficient delay because it jit-inserts the invoice when the htlc arrives. It is kind of unsatisfactory that the subscribe call doesn't give a signal when it is actually subscribed though.

ctxc, cancelSubscription := context.WithCancel(ctxb)
bobInvoiceSubscription, err := ctx.bob.SubscribeInvoices(ctxc, req)
require.NoError(t.t, err)
defer cancelSubscription()

const paymentAmt = btcutil.Amount(300000)

// Set up a network with three different paths Alice <-> Bob. Channel
Expand All @@ -61,13 +70,6 @@ func testSendPaymentAMPInvoiceCase(net *lntest.NetworkHarness, t *harnessTest,

ctx.waitForChannels()

// Subscribe to bob's invoices.
req := &lnrpc.InvoiceSubscription{}
ctxc, cancelSubscription := context.WithCancel(ctxb)
bobInvoiceSubscription, err := ctx.bob.SubscribeInvoices(ctxc, req)
require.NoError(t.t, err)
defer cancelSubscription()

addInvoiceResp, err := ctx.bob.AddInvoice(context.Background(), &lnrpc.Invoice{
Value: int64(paymentAmt),
IsAmp: true,
Expand Down