From 6bc0862fdf8cda9aaa15a6d6b89603ca0eab5558 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Fri, 1 Oct 2021 10:25:50 +0200 Subject: [PATCH] itest: fix commitment_deadline context expired flake --- lntest/itest/lnd_channel_force_close_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lntest/itest/lnd_channel_force_close_test.go b/lntest/itest/lnd_channel_force_close_test.go index 461be62cc..7225c4a2c 100644 --- a/lntest/itest/lnd_channel_force_close_test.go +++ b/lntest/itest/lnd_channel_force_close_test.go @@ -94,9 +94,6 @@ func testCommitmentTransactionDeadline(net *lntest.NetworkHarness, // calculateSweepFeeRate runs multiple steps to calculate the fee rate // used in sweeping the transactions. calculateSweepFeeRate := func(expectedSweepTxNum int) int64 { - ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) - defer cancel() - // Create two nodes, Alice and Bob. alice := setupNode("Alice") defer shutdownAndAssert(net, t, alice) @@ -118,6 +115,8 @@ func testCommitmentTransactionDeadline(net *lntest.NetworkHarness, // Send a payment with a specified finalCTLVDelta, which will // be used as our deadline later on when Alice force closes the // channel. + ctxt, cancel := context.WithTimeout(ctxb, defaultTimeout) + defer cancel() _, err := alice.RouterClient.SendPaymentV2( ctxt, &routerrpc.SendPaymentRequest{ Dest: bob.PubKey[:], @@ -145,6 +144,8 @@ func testCommitmentTransactionDeadline(net *lntest.NetworkHarness, // Now that the channel has been force closed, it should show // up in the PendingChannels RPC under the waiting close // section. + ctxt, cancel = context.WithTimeout(ctxb, defaultTimeout) + defer cancel() pendingChansRequest := &lnrpc.PendingChannelsRequest{} pendingChanResp, err := alice.PendingChannels( ctxt, pendingChansRequest,