aboutsummaryrefslogtreecommitdiff
path: root/test/functional/rpc_bind.py
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-12-08 11:29:28 +0000
committerfanquake <fanquake@gmail.com>2023-12-08 11:33:27 +0000
commit03042fb6bb35135566f47892b7fd15b34ca19cef (patch)
tree6d22125b3095dd3a0f6f64dbdf45bf1f6687785e /test/functional/rpc_bind.py
parent1f352cf2fd7c616480e403ecebb52597e61dbfb1 (diff)
parent00e0658e77f66103ebdeb29def99dc9f937c049d (diff)
Merge bitcoin/bitcoin#29006: test: fix v2 transport intermittent test failure (#29002)
00e0658e77f66103ebdeb29def99dc9f937c049d test: fix v2 transport intermittent test failure (#29002) (Sebastian Falbesoner) Pull request description: This PR improves the following fragile construct for detection of a new connection to the node under test in `p2p_v2_transport.py`: https://github.com/bitcoin/bitcoin/blob/6d5790956f45e3de5c6c4ee6fda21878b0d1287b/test/functional/p2p_v2_transport.py#L154-L156 Only relying on the number of peers for that suffers from race conditions, as unrelated previous peers could disconnect at anytime in-between. In the test run in #29002, the following happens: - `getpeerinfo()` is called the first time -> assigned to `num_peers` - **previous peer disconnects**, the node's peer count is now `num_peers - 1` (in most test runs, this happens before the first getpeerinfo call) - new peer connects, the node's peer count is now `num_peers` - the condition that the node's peer count is `num_peers + 1` is never true, test fails Use the more robust approach of watching for an increased highest peer id instead (again using the `getpeerinfo` RPC call), with a newly introduced context manager method `TestNode.wait_for_new_peer()`. Note that for the opposite case of a disconnect, no new method is introduced; this is currently used only once in the test and is also simpler. Still happy to take suggestions for alternative solutions. Fixes #29002. ACKs for top commit: kevkevinpal: Concept ACK [00e0658](https://github.com/bitcoin/bitcoin/pull/29006/commits/00e0658e77f66103ebdeb29def99dc9f937c049d) maflcko: Ok, lgtm ACK 00e0658e77f66103ebdeb29def99dc9f937c049d stratospher: ACK 00e0658. Tree-SHA512: 0118b87f54ea5e6e080ff44f29d6af6674c757a588534b3add040da435f4359e71bf85bc0a5eb7170f99cc9956e1a03c35cce653d642d31eed41bbed1f94f44f
Diffstat (limited to 'test/functional/rpc_bind.py')
0 files changed, 0 insertions, 0 deletions