Closes: #19080
This PR creates a wait_until method for the BitcoinTestFramework class, and replaces all uses of the global wait_until with the class method. If applicable, the mininode wait_until is used instead.
15 from test_framework.util import (
16     assert_equal,
17     disconnect_nodes,
18-    connect_nodes,
19-    wait_until,
20+    connect_nodes
67+        node0.wait_until(lambda: self.nodes[0].getblockcount() == 1000)
68         stale_block_hash = self.nodes[0].getblockhash(1000)
69 
70         self.nodes[1].generate(1001)
71-        wait_until(lambda: self.nodes[1].getblockcount() == 2000)
72+        node1.wait_until(lambda: self.nodes[1].getblockcount() == 2000)
node1 is a mininode. self.nodes[1] is a TestNode.
It might be best to add a def wait_until(self, ...): to the test framework.
0        self.wait_until(lambda: self.nodes[1].getblockcount() == 2000)
feature_abortnode.py here to use wait_until_node_stopped so that it uses the test_node timeout factor.
        
      The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
82-    def wait_for_block_announcement(self, block_hash, timeout=30):
83+    def wait_for_block_announcement(self, block_hash):
84         def received_hash():
85             return (block_hash in self.announced_blockhashes)
86-        wait_until(received_hash, timeout=timeout, lock=mininode_lock)
87+        self.wait_until(received_hash,)
, if no other arguments being passed in.
              
             97         # Check that get*info() shows the versionbits unknown rules warning
 98         assert WARN_UNKNOWN_RULES_ACTIVE in node.getmininginfo()["warnings"]
 99         assert WARN_UNKNOWN_RULES_ACTIVE in node.getnetworkinfo()["warnings"]
100         # Check that the alert file shows the versionbits unknown rules warning
101-        wait_until(lambda: self.versionbits_in_alert_file(), timeout=60)
102+        self.wait_until(lambda: self.versionbits_in_alert_file(), timeout=60)
72@@ -73,23 +73,23 @@ def send_header_for_blocks(self, new_blocks):
73     def request_headers_and_sync(self, locator, hashstop=0):
74         self.clear_block_announcement()
75         self.get_headers(locator, hashstop)
76-        wait_until(self.received_block_announcement, timeout=30, lock=mininode_lock)
77+        self.wait_until(self.received_block_announcement)
Concept ACK
I think you missed test/functional/p2p_ping.py. And in your current commit order you are using the TestFramework wait_until before it is added. But I am not sure if that is viewed as critical (so nit). Otherwise lgtm.