mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
test: Avoid hard time.sleep(1) in feature_init.py
This commit is contained in:
@@ -10,7 +10,6 @@ import platform
|
|||||||
import shutil
|
import shutil
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
|
||||||
|
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.test_node import (
|
from test_framework.test_node import (
|
||||||
@@ -272,7 +271,8 @@ class InitTest(BitcoinTestFramework):
|
|||||||
# returns early it will return the current block height.
|
# returns early it will return the current block height.
|
||||||
self.log.debug(f"Calling waitforblockheight with {self.rpc_timeout} sec RPC timeout")
|
self.log.debug(f"Calling waitforblockheight with {self.rpc_timeout} sec RPC timeout")
|
||||||
fut = ex.submit(node.waitforblockheight, height=current_height+1, timeout=self.rpc_timeout*1000*2)
|
fut = ex.submit(node.waitforblockheight, height=current_height+1, timeout=self.rpc_timeout*1000*2)
|
||||||
time.sleep(1)
|
|
||||||
|
self.wait_until(lambda: any(c["method"] == "waitforblockheight" for c in node.cli.getrpcinfo()["active_commands"]))
|
||||||
|
|
||||||
self.log.debug(f"Sending break signal to pid {node.process.pid}")
|
self.log.debug(f"Sending break signal to pid {node.process.pid}")
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
|
|||||||
Reference in New Issue
Block a user