diff --git a/lnd_test.go b/lnd_test.go index c7ae64e6..2f5a09ad 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -771,7 +771,6 @@ func testOnchainFundRecovery(net *lntest.NetworkHarness, t *harnessTest) { // conditions. Finally, the chain itself is checked to ensure the closing // transaction was mined. func testBasicChannelFunding(net *lntest.NetworkHarness, t *harnessTest) { - timeout := time.Duration(time.Second * 5) ctxb := context.Background() chanAmt := maxBtcFundingAmount @@ -825,7 +824,7 @@ func testBasicChannelFunding(net *lntest.NetworkHarness, t *harnessTest) { // Finally, immediately close the channel. This function will also // block until the channel is closed and will additionally assert the // relevant channel closing post conditions. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) } @@ -906,7 +905,7 @@ func testUnconfirmedChannelFunding(net *lntest.NetworkHarness, t *harnessTest) { } // Now that we're done with the test, the channel can be closed. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPoint, false) } @@ -1501,11 +1500,11 @@ func testUpdateChannelPolicy(net *lntest.NetworkHarness, t *harnessTest) { } // Close the channels. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Bob, chanPoint2, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint3, false) } @@ -1804,7 +1803,7 @@ func testDisconnectingTargetPeer(net *lntest.NetworkHarness, t *harnessTest) { // Check existing connection. assertNumConnections(ctxb, t, net.Alice, net.Bob, 1) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, true) // Disconnect Alice-peer from Bob-peer without getting error @@ -1969,7 +1968,7 @@ func testChannelFundingPersistence(net *lntest.NetworkHarness, t *harnessTest) { }, OutputIndex: pendingUpdate.OutputIndex, } - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) } @@ -2037,8 +2036,8 @@ func testChannelBalance(net *lntest.NetworkHarness, t *harnessTest) { // Finally close the channel between Alice and Bob, asserting that the // channel has been properly closed on-chain. - ctx, _ = context.WithTimeout(context.Background(), timeout) - closeChannelAndAssert(ctx, t, net, net.Alice, chanPoint, false) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) + closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) } // findForceClosedChannel searches a pending channel response for a particular @@ -3102,7 +3101,7 @@ func testSphinxReplayPersistence(net *lntest.NetworkHarness, t *harnessTest) { // unaltered. assertAmountSent(0) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPoint, true) // Cleanup by mining the force close and sweep transaction. @@ -3246,7 +3245,7 @@ func testSingleHopInvoice(net *lntest.NetworkHarness, t *harnessTest) { time.Sleep(time.Millisecond * 200) assertAmountSent(paymentAmt * 2) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) } @@ -3385,7 +3384,7 @@ func testListPayments(net *lntest.NetworkHarness, t *harnessTest) { len(paymentsRespInit.Payments), 0) } - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) } @@ -3767,11 +3766,11 @@ func testMultiHopPayments(net *lntest.NetworkHarness, t *harnessTest) { } } - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, dave, chanPointDave, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointCarol, false) } @@ -3918,7 +3917,7 @@ func testSingleHopSendToRoute(net *lntest.NetworkHarness, t *harnessTest) { assertAmountPaid(t, ctxb, "Alice(local) => Bob(remote)", net.Alice, aliceFundPoint, amountPaid, int64(0)) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) } @@ -4111,9 +4110,9 @@ func testMultiHopSendToRoute(net *lntest.NetworkHarness, t *harnessTest) { assertAmountPaid(t, ctxb, "Alice(local) => Bob(remote)", net.Alice, aliceFundPoint, amountPaid+(baseFee*numPayments), int64(0)) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointBob, false) } @@ -4237,9 +4236,9 @@ func testSendToRouteErrorPropagation(net *lntest.NetworkHarness, t *harnessTest) t.Fatalf("payment stream has been closed but fake route has consumed: %v", err) } - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointCarol, false) } @@ -4349,7 +4348,7 @@ func testUnannouncedChannels(net *lntest.NetworkHarness, t *harnessTest) { } // Close the channel used during the test. - ctx, _ = context.WithTimeout(ctb, timeout) + ctx, _ = context.WithTimeout(ctb, channelCloseTimeout) closeChannelAndAssert(ctx, t, net, net.Alice, fundingChanPoint, false) } @@ -4694,13 +4693,13 @@ func testPrivateChannels(net *lntest.NetworkHarness, t *harnessTest) { } // Close all channels. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, dave, chanPointDave, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointCarol, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointPrivate, false) } @@ -4901,18 +4900,18 @@ func testInvoiceRoutingHints(net *lntest.NetworkHarness, t *harnessTest) { // Now that we've confirmed the routing hints were added correctly, we // can close all the channels and shut down all the nodes created. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointBob, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointCarol, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Bob, chanPointBobCarol, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointDave, false) // The channel between Alice and Eve should be force closed since Eve // is offline. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointEve, true) // Cleanup by mining the force close and sweep transaction. @@ -5136,11 +5135,11 @@ func testMultiHopOverPrivateChannels(net *lntest.NetworkHarness, t *harnessTest) // At this point, the payment was successful. We can now close all the // channels and shutdown the nodes created throughout this test. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Bob, chanPointBob, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointCarol, false) } @@ -5366,7 +5365,7 @@ func testInvoiceSubscriptions(net *lntest.NetworkHarness, t *harnessTest) { t.Fatalf("not all invoices settled") } - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) } @@ -5396,8 +5395,8 @@ func testBasicChannelCreation(net *lntest.NetworkHarness, t *harnessTest) { // Close the channel between Alice and Bob, asserting that the // channel has been properly closed on-chain. for _, chanPoint := range chanPoints { - ctx, _ := context.WithTimeout(context.Background(), timeout) - closeChannelAndAssert(ctx, t, net, net.Alice, chanPoint, false) + ctxt, _ := context.WithTimeout(ctxb, channelCloseTimeout) + closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) } } @@ -5521,7 +5520,7 @@ func testMaxPendingChannels(net *lntest.NetworkHarness, t *harnessTest) { // Next, close the channel between Alice and Carol, asserting that the // channel has been properly closed on-chain. for _, chanPoint := range chanPoints { - ctxt, _ := context.WithTimeout(context.Background(), timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) } } @@ -5954,14 +5953,14 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) { // Now, we'll close the channel between Alice and Bob and ensure there // is no reconnection logic between the both once the channel is fully // closed. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, coopChanPoint, false) testReconnection(net.Bob) // We'll do the same with Alice and Carol, but this time we'll force // close the channel instead. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, forceCloseChanPoint, true) // Cleanup by mining the force close and sweep transaction. @@ -6038,7 +6037,7 @@ func testGarbageCollectLinkNodes(net *lntest.NetworkHarness, t *harnessTest) { } // Now that the test is done, we can also close the persistent link. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, persistentChanPoint, false) } @@ -7296,7 +7295,7 @@ func testDataLossProtection(net *lntest.NetworkHarness, t *harnessTest) { carolStartingBalance = carolBalResp.ConfirmedBalance // Now let Carol force close the channel while Dave is offline. - ctxt, _ := context.WithTimeout(ctxb, timeout) + ctxt, _ := context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPoint2, true) // Wait for the channel to be marked pending force close. @@ -7683,7 +7682,7 @@ out: // Finally, immediately close the channel. This function will also // block until the channel is closed and will additionally assert the // relevant channel closing post conditions. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) // Force close Bob's final channel. @@ -7844,7 +7843,7 @@ func testGraphTopologyNotifications(net *lntest.NetworkHarness, t *harnessTest) // Now we'll test that updates are properly sent after channels are closed // within the network. - ctxt, _ = context.WithTimeout(context.Background(), timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) // Now that the channel has been closed, we should receive a @@ -7981,7 +7980,7 @@ out: } // Close the channel between Bob and Carol. - ctxt, _ = context.WithTimeout(context.Background(), timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Bob, chanPoint, false) } @@ -8017,7 +8016,6 @@ func testNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) { t.Fatalf("unable to connect bob to carol: %v", err) } - timeout := time.Duration(time.Second * 5) ctxt, _ := context.WithTimeout(ctxb, channelOpenTimeout) chanPoint := openChannelAndAssert( ctxt, t, net, net.Bob, dave, @@ -8074,12 +8072,11 @@ func testNodeAnnouncement(net *lntest.NetworkHarness, t *harnessTest) { ) // Close the channel between Bob and Dave. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Bob, chanPoint, false) } func testNodeSignVerify(net *lntest.NetworkHarness, t *harnessTest) { - timeout := time.Duration(time.Second * 15) ctxb := context.Background() chanAmt := maxBtcFundingAmount @@ -8150,7 +8147,7 @@ func testNodeSignVerify(net *lntest.NetworkHarness, t *harnessTest) { } // Close the channel between alice and bob. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, aliceBobCh, false) } @@ -8308,7 +8305,7 @@ func testAsyncPayments(net *lntest.NetworkHarness, t *harnessTest) { // Finally, immediately close the channel. This function will also // block until the channel is closed and will additionally assert the // relevant channel closing post conditions. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) } @@ -8507,7 +8504,7 @@ func testBidirectionalAsyncPayments(net *lntest.NetworkHarness, t *harnessTest) // Finally, immediately close the channel. This function will also // block until the channel is closed and will additionally assert the // relevant channel closing post conditions. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, false) } @@ -8709,7 +8706,6 @@ func createThreeHopHodlNetwork(t *harnessTest, // timeout has been reached, then we should sweep it on-chain, and cancel the // HTLC backwards. func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest) { - timeout := time.Duration(time.Second * 15) ctxb := context.Background() // First, we'll create a three hop network: Alice -> Bob -> Carol, with @@ -8933,7 +8929,7 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest) { t.Fatalf(predErr.Error()) } - ctxt, _ := context.WithTimeout(ctxb, timeout) + ctxt, _ := context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, aliceChanPoint, false) } @@ -8943,7 +8939,6 @@ func testMultiHopHtlcLocalTimeout(net *lntest.NetworkHarness, t *harnessTest) { // node that sent the outgoing HTLC should extract the preimage from the sweep // transaction, and finish settling the HTLC backwards into the route. func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest) { - timeout := time.Duration(time.Second * 15) ctxb := context.Background() defaultCSV := uint32(4) @@ -9160,7 +9155,7 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest) // We'll close out the channel between Alice and Bob, then shutdown // carol to conclude the test. - ctxt, _ := context.WithTimeout(ctxb, timeout) + ctxt, _ := context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, aliceChanPoint, false) } @@ -9172,7 +9167,6 @@ func testMultiHopReceiverChainClaim(net *lntest.NetworkHarness, t *harnessTest) func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness, t *harnessTest) { - timeout := time.Duration(time.Second * 15) ctxb := context.Background() // First, we'll create a three hop network: Alice -> Bob -> Carol, with @@ -9228,7 +9222,7 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness, // Now that all parties have the HTLC locked in, we'll immediately // force close the Bob -> Carol channel. This should trigger contract // resolution mode for both of them. - ctxt, _ := context.WithTimeout(ctxb, timeout) + ctxt, _ := context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Bob, bobChanPoint, true) // At this point, Bob should have a pending force close channel as he @@ -9417,7 +9411,7 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness, t.Fatalf(predErr.Error()) } - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, aliceChanPoint, false) } @@ -9429,7 +9423,6 @@ func testMultiHopLocalForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness, func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness, t *harnessTest) { - timeout := time.Duration(time.Second * 15) ctxb := context.Background() // First, we'll create a three hop network: Alice -> Bob -> Carol, with @@ -9485,7 +9478,7 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness, // At this point, we'll now instruct Carol to force close the // transaction. This will let us exercise that Bob is able to sweep the // expired HTLC on Carol's version of the commitment transaction. - ctxt, _ := context.WithTimeout(ctxb, timeout) + ctxt, _ := context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, bobChanPoint, true) // At this point, Bob should have a pending force close channel as @@ -9632,7 +9625,7 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness, // We'll close out the test by closing the channel from Alice to Bob, // and then shutting down the new node we created as its no longer // needed. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, aliceChanPoint, false) } @@ -9641,7 +9634,6 @@ func testMultiHopRemoteForceCloseOnChainHtlcTimeout(net *lntest.NetworkHarness, // preimage via the witness beacon, we properly settle the HTLC on-chain in // order to ensure we don't lose any funds. func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest) { - timeout := time.Duration(time.Second * 15) ctxb := context.Background() defaultCSV := uint32(4) @@ -9695,7 +9687,7 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest) // At this point, Bob decides that he wants to exit the channel // immediately, so he force closes his commitment transaction. - ctxt, _ := context.WithTimeout(ctxb, timeout) + ctxt, _ := context.WithTimeout(ctxb, channelCloseTimeout) bobForceClose := closeChannelAndAssert(ctxt, t, net, net.Bob, aliceChanPoint, true) @@ -9967,7 +9959,6 @@ func testMultiHopHtlcLocalChainClaim(net *lntest.NetworkHarness, t *harnessTest) // we found out the preimage via the witness beacon, we properly settle the // HTLC on-chain in order to ensure that we don't lose any funds. func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest) { - timeout := time.Duration(time.Second * 15) ctxb := context.Background() defaultCSV := uint32(4) @@ -10022,7 +10013,7 @@ func testMultiHopHtlcRemoteChainClaim(net *lntest.NetworkHarness, t *harnessTest // Next, Alice decides that she wants to exit the channel, so she'll // immediately force close the channel by broadcast her commitment // transaction. - ctxt, _ := context.WithTimeout(ctxb, timeout) + ctxt, _ := context.WithTimeout(ctxb, channelCloseTimeout) aliceForceClose := closeChannelAndAssert(ctxt, t, net, net.Alice, aliceChanPoint, true) @@ -10546,11 +10537,11 @@ func testSwitchCircuitPersistence(net *lntest.NetworkHarness, t *harnessTest) { assertAmountPaid(t, ctxb, "Bob(local) => Alice(remote)", net.Bob, aliceFundPoint, amountPaid+(baseFee*(numPayments+1))*2, int64(0)) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, dave, chanPointDave, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointCarol, false) } @@ -10888,11 +10879,11 @@ func testSwitchOfflineDelivery(net *lntest.NetworkHarness, t *harnessTest) { assertAmountPaid(t, ctxb, "Bob(local) => Alice(remote)", net.Bob, aliceFundPoint, amountPaid+(baseFee*(numPayments+1))*2, int64(0)) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, dave, chanPointDave, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointCarol, false) } @@ -11237,11 +11228,11 @@ func testSwitchOfflineDeliveryPersistence(net *lntest.NetworkHarness, t *harness assertAmountPaid(t, ctxb, "Bob(local) => Alice(remote)", net.Bob, aliceFundPoint, amountPaid+(baseFee*(numPayments+1))*2, int64(0)) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, dave, chanPointDave, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointCarol, false) } @@ -11543,9 +11534,9 @@ func testSwitchOfflineDeliveryOutgoingOffline( assertAmountPaid(t, ctxb, "Bob(local) => Alice(remote)", net.Bob, aliceFundPoint, amountPaid+(baseFee*numPayments)*2, int64(0)) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, dave, chanPointDave, false) } @@ -11739,11 +11730,11 @@ func testQueryRoutes(net *lntest.NetworkHarness, t *harnessTest) { // We clean up the test case by closing channels that were created for // the duration of the tests. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAlice, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Bob, chanPointBob, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointCarol, false) } @@ -12021,13 +12012,13 @@ func testRouteFeeCutoff(net *lntest.NetworkHarness, t *harnessTest) { // Once we're done, close the channels and shut down the nodes created // throughout this test. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAliceBob, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPointAliceCarol, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Bob, chanPointBobDave, false) - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, carol, chanPointCarolDave, false) } @@ -12154,13 +12145,13 @@ func testSendUpdateDisableChannel(net *lntest.NetworkHarness, t *harnessTest) { // Close Alice's channels with Bob and Carol cooperatively and // unilaterally respectively. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) _, _, err = net.CloseChannel(ctxt, net.Alice, chanPointAliceBob, false) if err != nil { t.Fatalf("unable to close channel: %v", err) } - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) _, _, err = net.CloseChannel(ctxt, net.Alice, chanPointAliceCarol, true) if err != nil { t.Fatalf("unable to close channel: %v", err) @@ -12185,7 +12176,7 @@ func testSendUpdateDisableChannel(net *lntest.NetworkHarness, t *harnessTest) { mineBlocks(t, net, 1) // Also do this check for Eve's channel with Carol. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) _, _, err = net.CloseChannel(ctxt, eve, chanPointEveCarol, false) if err != nil { t.Fatalf("unable to close channel: %v", err) @@ -12297,7 +12288,7 @@ func testAbandonChannel(net *lntest.NetworkHarness, t *harnessTest) { // Now that we're done with the test, the channel can be closed. This is // necessary to avoid unexpected outcomes of other tests that use Bob's // lnd instance. - ctxt, _ = context.WithTimeout(ctxb, timeout) + ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Bob, chanPoint, true) // Cleanup by mining the force close and sweep transaction.