itest: fix testGraphTopologyNtfns and mark a bug in disconnectpeer

This commit is contained in:
yyforyongyu 2022-11-09 17:10:59 +08:00
parent 25a2e0f716
commit 92a2da52c5
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868

View File

@ -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