test: Add check_interval parameter to wait_until

This also replaces two sleep calls in functional tests with wait_until
This commit is contained in:
Fabian Jahr
2024-09-21 21:23:14 +02:00
parent 16c87d91fd
commit 5468a23eb9
5 changed files with 12 additions and 12 deletions

View File

@@ -6,7 +6,6 @@
Test Inactive HD Chains.
"""
import shutil
import time
from test_framework.authproxy import JSONRPCException
from test_framework.test_framework import BitcoinTestFramework
@@ -75,12 +74,13 @@ class InactiveHDChainsTest(BitcoinTestFramework):
self.generate(self.nodes[0], 1)
# Wait for the test wallet to see the transaction
while True:
def is_tx_available(txid):
try:
test_wallet.gettransaction(txid)
break
return True
except JSONRPCException:
time.sleep(0.1)
return False
self.nodes[0].wait_until(lambda: is_tx_available(txid), timeout=10, check_interval=0.1)
if encrypt:
# The test wallet will not be able to generate the topped up keypool