mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
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.
This commit is contained in:
parent
3e691258d8
commit
ea00f982d2
1 changed files with 1 additions and 1 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue