ipc test: add workaround to block_reserved_weight exception test
What changed, and why it matters
This is a test-only change in Bitcoin Core. It adds a temporary workaround in an automated test so the test can keep running even when a known bug in a supporting library (libmultiprocess) causes the tested program to crash. The change does not alter normal Bitcoin node behavior, wallet handling, consensus rules, or network protocol handling, so it is not a security vulnerability in Bitcoin Core itself.
No immediate action required for Bitcoin Core users or operators. Treat as a test maintenance commit. Monitor libmultiprocess PR #218 for the upstream fix and revert or tighten the test workaround once it is available and integrated.
Security signals we found
Known upstream library bug referenced (libmultiprocess PR #218)
std::terminate and node disconnect behavior in test scenario
No change to production code, consensus, networking, or wallet logic
Test-only exception-handling relaxation
Evidence from the diff
The commit modifies test/functional/interface_ipc_mining.py. The test exercises the IPC mining interface and previously expected a specific Cap’n Proto exception (‘FAILED’ with a ‘block_reserved_weight’ message) when blockReservedWeight is set too low. Because libmultiprocess currently fails to propagate uncaught exceptions correctly when an mp.Context parameter is passed and the call runs on a worker thread—resulting in std::terminate and node disconnect—the test now also accepts a ‘DISCONNECTED’ exception, waits for the node to stop, and restarts it. This is a workaround for a known upstream bug fixed by libmultiprocess PR #218. It is purely a test-harness adjustment.
Changed components
test/functional/interface_ipc_mining.pyInspect captured patch +16 / −6
diff --git a/test/functional/interface_ipc_mining.py b/test/functional/interface_ipc_mining.py
index 61c050e7..d4a0d87e 100755
--- a/test/functional/interface_ipc_mining.py
+++ b/test/functional/interface_ipc_mining.py
@@ -6,6 +6,7 @@
import asyncio
from contextlib import AsyncExitStack
from io import BytesIO
+import re
from test_framework.blocktools import NULL_OUTPOINT
from test_framework.messages import (
MAX_BLOCK_WEIGHT,
@@ -257,12 +258,21 @@ class IPCMiningTest(BitcoinTestFramework):
empty_block = await mining_get_block(empty_template, ctx)
assert_equal(len(empty_block.vtx), 1)
- self.log.debug("Enforce minimum reserved weight for IPC clients too")
- opts.blockReservedWeight = 0
- try:
- await mining.createNewBlock(opts)
- raise AssertionError("createNewBlock unexpectedly succeeded")
- except capnp.lib.capnp.KjException as e:
+ self.log.debug("Enforce minimum reserved weight for IPC clients too")
+ opts.blockReservedWeight = 0
+ try:
+ await mining.createNewBlock(opts)
+ raise AssertionError("createNewBlock unexpectedly succeeded")
+ except capnp.lib.capnp.KjException as e:
+ if e.type == "DISCONNECTED":
+ # The remote exception isn't caught currently and leads to a
+ # std::terminate call. Just detect and restart in this case.
+ # This bug is fixed with
+ # https://github.com/bitcoin-core/libmultiprocess/pull/218
+ assert_equal(e.description, "Peer disconnected.")
+ self.nodes[0].wait_until_stopped(expected_ret_code=(-11, -6, 1, 66), expected_stderr=re.compile(""))
+ self.start_node(0)
+ else:
assert_equal(e.description, "remote exception: std::exception: block_reserved_weight (0) must be at least 2000 weight units")
assert_equal(e.type, "FAILED")
Why this scored 16/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.