From 92a2da52c5eb17f5df0feeda9545e0d83595e2c2 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Wed, 9 Nov 2022 17:10:59 +0800 Subject: [PATCH] itest: fix `testGraphTopologyNtfns` and mark a bug in disconnectpeer --- itest/lnd_channel_graph_test.go | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/itest/lnd_channel_graph_test.go b/itest/lnd_channel_graph_test.go index b01879c18..ed4dfa25a 100644 --- a/itest/lnd_channel_graph_test.go +++ b/itest/lnd_channel_graph_test.go @@ -335,10 +335,20 @@ func testGraphTopologyNtfns(ht *lntest.HarnessTest, pinned bool) { // For the final portion of the test, we'll ensure that once a new node // appears in the network, the proper notification is dispatched. Note - // that a node that does not have any channels open is ignored, so first - // we disconnect Alice and Bob, open a channel between Bob and Carol, - // and finally connect Alice to Bob again. - ht.DisconnectNodes(alice, bob) + // that a node that does not have any channels open is ignored, so + // first we disconnect Alice and Bob, open a channel between Bob and + // Carol, and finally connect Alice to Bob again. + ht.DisconnectNodes(bob, alice) + + // Since Alice and Bob has a permanent connection, the above + // disconnection won't be enough as Alice will try to reconnect to Bob + // again. Atm, it seems nothing is stopping the reconnection. So we + // need to shutdown Alice here. + // + // TODO(yy): clearly define what `disconnectpeer` rpc is responsible + // for and its effect. If we disconnect a peer, we shouldn't allow the + // peer to connect to us again. + restartAlice := ht.SuspendNode(alice) carol := ht.NewNode("Carol", nil) ht.ConnectNodes(bob, carol) @@ -346,6 +356,9 @@ func testGraphTopologyNtfns(ht *lntest.HarnessTest, pinned bool) { bob, carol, lntest.OpenChannelParams{Amt: chanAmt}, ) + // Restart Alice so she can receive the channel updates from Bob. + require.NoError(ht, restartAlice(), "failed to restart Alice") + // Reconnect Alice and Bob. This should result in the nodes syncing up // their respective graph state, with the new addition being the // existence of Carol in the graph, and also the channel between Bob