mining: enforce minimum reserved weight for IPC

Previously a lower value was silently clamped to MINIMUM_BLOCK_RESERVED_WEIGHT.
This commit is contained in:
Sjors Provoost
2026-02-07 13:50:18 +01:00
parent d3e49528d4
commit b623fab1ba
3 changed files with 22 additions and 1 deletions

View File

@@ -257,6 +257,15 @@ 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:
assert_equal(e.description, "remote exception: std::exception: block_reserved_weight (0) must be at least 2000 weight units")
assert_equal(e.type, "FAILED")
asyncio.run(capnp.run(async_routine()))
def run_coinbase_and_submission_test(self):