diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2023-12-09 13:26:18 +0100 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2023-12-09 13:26:18 +0100 |
commit | ea00f982d21aab51001d422225f00626a74db298 (patch) | |
tree | 767d12655ae522be30af62a9398b92751aae7f0d /test/functional/rpc_net.py | |
parent | 3e691258d8789a4a89cce42e7e71b130491594d7 (diff) | |
download | bitcoin-ea00f982d21aab51001d422225f00626a74db298.tar.xz |
test: fix intermittent error in rpc_net.py (#29030)
Asserting for the debug log message "Added connection peer=" is
insufficient for ensuring that this new connection will show up in a
following getpeerinfo() call, as the debug message is written in the
CNode ctor, which means it hasn't necessarily been added to
CConnman.m_nodes at this point.
Solve this by using the recently introduced `wait_for_new_peer`
helper, which is more robust.
Fixes #29030.
Diffstat (limited to 'test/functional/rpc_net.py')
-rwxr-xr-x | test/functional/rpc_net.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py index b193ffd462..d75f05105b 100755 --- a/test/functional/rpc_net.py +++ b/test/functional/rpc_net.py @@ -110,7 +110,7 @@ class NetTest(BitcoinTestFramework): no_version_peer_id = 2 no_version_peer_conntime = int(time.time()) self.nodes[0].setmocktime(no_version_peer_conntime) - with self.nodes[0].assert_debug_log([f"Added connection peer={no_version_peer_id}"]): + with self.nodes[0].wait_for_new_peer(): no_version_peer = self.nodes[0].add_p2p_connection(P2PInterface(), send_version=False, wait_for_verack=False) self.nodes[0].setmocktime(0) peer_info = self.nodes[0].getpeerinfo()[no_version_peer_id] |