Skip to content

Commit 1819564

Browse files
committed
test: fix intermittent issue in p2p_disconnect_ban
When `node0` calls `disconnectnode` to disconnect `node1`, we should check in `node1` if it worked, because for `node0` the informations in `getpeerinfo` may be updated before really completing the disconnection.
1 parent 08b65df commit 1819564

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/functional/p2p_disconnect_ban.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def run_test(self):
116116
self.log.info("disconnectnode: successfully disconnect node by address")
117117
address1 = self.nodes[0].getpeerinfo()[0]['addr']
118118
self.nodes[0].disconnectnode(address=address1)
119-
self.wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 1, timeout=10)
119+
self.wait_until(lambda: len(self.nodes[1].getpeerinfo()) == 1, timeout=10)
120120
assert not [node for node in self.nodes[0].getpeerinfo() if node['addr'] == address1]
121121

122122
self.log.info("disconnectnode: successfully reconnect node")
@@ -127,7 +127,7 @@ def run_test(self):
127127
self.log.info("disconnectnode: successfully disconnect node by node id")
128128
id1 = self.nodes[0].getpeerinfo()[0]['id']
129129
self.nodes[0].disconnectnode(nodeid=id1)
130-
self.wait_until(lambda: len(self.nodes[0].getpeerinfo()) == 1, timeout=10)
130+
self.wait_until(lambda: len(self.nodes[1].getpeerinfo()) == 1, timeout=10)
131131
assert not [node for node in self.nodes[0].getpeerinfo() if node['id'] == id1]
132132

133133
if __name__ == '__main__':

0 commit comments

Comments
 (0)