From ad75b147b5c3ab5eac268a1c1ced23894a8a79ba Mon Sep 17 00:00:00 2001 From: Enoch Azariah Date: Fri, 13 Mar 2026 11:13:25 +0100 Subject: [PATCH] test: scale IPC mining wait timeouts by timeout_factor The IPC mining tests (interface_ipc_mining.py) currently use hardcoded timeouts (e.g., 1000ms, 60000ms) for operations like waitTipChanged and waiting for block templates. In heavily loaded CI environments, such as those running sanitizers with high parallelism, these hardcoded timeouts can be too short, leading to spurious test failures and brittleness. This commit multiplies these timeout variables by the test suite's global `self.options.timeout_factor`. This ensures that the IPC wait conditions scale appropriately when the test suite is run with a higher timeout factor, making the tests robust against slow execution environments. Addresses CI brittleness observed in bitcoin-core/libmultiprocess#253. --- test/functional/interface_ipc_mining.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/functional/interface_ipc_mining.py b/test/functional/interface_ipc_mining.py index 0c3b9cf869c..31ccec63fa8 100755 --- a/test/functional/interface_ipc_mining.py +++ b/test/functional/interface_ipc_mining.py @@ -110,7 +110,7 @@ class IPCMiningTest(BitcoinTestFramework): """Test Mining interface methods.""" self.log.info("Running Mining interface test") block_hash_size = 32 - timeout = 1000.0 # 1000 milliseconds + timeout = 1000.0 * self.options.timeout_factor # 1000 milliseconds async def async_routine(): ctx, mining = await make_mining_ctx(self) @@ -132,7 +132,7 @@ class IPCMiningTest(BitcoinTestFramework): self.log.debug("interrupt() should abort waitTipChanged()") async def wait_for_tip(): - long_timeout = 60000.0 # 1 minute + long_timeout = max(timeout, 60000.0) # at least 1 minute result = (await mining.waitTipChanged(ctx, newblockref.hash, long_timeout)).result # Unlike a timeout, interrupt() returns an empty BlockRef. assert_equal(len(result.hash), 0) @@ -172,7 +172,7 @@ class IPCMiningTest(BitcoinTestFramework): """Test BlockTemplate interface methods.""" self.log.info("Running BlockTemplate interface test") block_header_size = 80 - timeout = 1000.0 # 1000 milliseconds + timeout = 1000.0 * self.options.timeout_factor async def async_routine(): ctx, mining = await make_mining_ctx(self) @@ -285,7 +285,7 @@ class IPCMiningTest(BitcoinTestFramework): self.log.debug("interruptWait should abort the current wait") async def wait_for_block(): new_waitoptions = self.capnp_modules['mining'].BlockWaitOptions() - new_waitoptions.timeout = timeout * 60 # 1 minute wait + new_waitoptions.timeout = max(timeout, 60000.0) # at least 1 minute new_waitoptions.feeThreshold = 1 template7 = await mining_wait_next_template(template6, stack, ctx, new_waitoptions) assert template7 is None