From 8e10da03c707e684d3283508e6058e22d70d1ab7 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Tue, 19 Nov 2019 20:12:07 -0800 Subject: [PATCH] lntest/itest: move chanpoint instantiation down to where it's used --- lntest/itest/lnd_test.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index 5817e85d..f5819100 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -2247,9 +2247,19 @@ func testDisconnectingTargetPeer(net *lntest.NetworkHarness, t *harnessTest) { t.Fatalf("unable to assert channel existence: %v", err) } - // 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. + // Disconnect Alice-peer from Bob-peer and get error causes by one + // active channel with detach node is existing. + if err := net.DisconnectNodes(ctxt, alice, bob); err == nil { + t.Fatalf("Bob's peer was disconnected from Alice's"+ + " while one active channel is existing: err %v", err) + } + + // Check existing connection. + assertNumConnections(t, alice, bob, 1) + + // 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. chanPoint := &lnrpc.ChannelPoint{ FundingTxid: &lnrpc.ChannelPoint_FundingTxidBytes{ FundingTxidBytes: pendingUpdate.Txid, @@ -2257,16 +2267,6 @@ func testDisconnectingTargetPeer(net *lntest.NetworkHarness, t *harnessTest) { OutputIndex: pendingUpdate.OutputIndex, } - // Disconnect Alice-peer from Bob-peer and get error - // causes by one active channel with detach node is existing. - if err := net.DisconnectNodes(ctxt, net.Alice, net.Bob); err == nil { - t.Fatalf("Bob's peer was disconnected from Alice's"+ - " while one active channel is existing: err %v", err) - } - - // Check existing connection. - assertNumConnections(t, net.Alice, net.Bob, 1) - ctxt, _ = context.WithTimeout(ctxb, channelCloseTimeout) closeChannelAndAssert(ctxt, t, net, net.Alice, chanPoint, true)