test: Avoid hard time.sleep(1) in feature_init.py

Github-Pull: #34137
Rebased-From: fa727e3ec984106371eeedb34d7bbbbc3dcce4ff
This commit is contained in:
MarcoFalke 2025-12-22 14:55:47 +01:00 committed by fanquake
parent c065bcd2d7
commit 7568bc3ab0
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -10,7 +10,6 @@ import platform
import shutil
import signal
import subprocess
import time
from test_framework.test_framework import BitcoinTestFramework
from test_framework.test_node import (
@ -272,7 +271,8 @@ class InitTest(BitcoinTestFramework):
# returns early it will return the current block height.
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)
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}")
if platform.system() == 'Windows':