Skip to content

Commit ea00f98

Browse files
committed
test: fix intermittent error in rpc_net.py (bitcoin#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 bitcoin#29030.
1 parent 3e69125 commit ea00f98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/functional/rpc_net.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_getpeerinfo(self):
110110
no_version_peer_id = 2
111111
no_version_peer_conntime = int(time.time())
112112
self.nodes[0].setmocktime(no_version_peer_conntime)
113-
with self.nodes[0].assert_debug_log([f"Added connection peer={no_version_peer_id}"]):
113+
with self.nodes[0].wait_for_new_peer():
114114
no_version_peer = self.nodes[0].add_p2p_connection(P2PInterface(), send_version=False, wait_for_verack=False)
115115
self.nodes[0].setmocktime(0)
116116
peer_info = self.nodes[0].getpeerinfo()[no_version_peer_id]

0 commit comments

Comments
 (0)