Commit Graph

6 Commits

Author SHA1 Message Date
Sjors Provoost
b623fab1ba mining: enforce minimum reserved weight for IPC
Previously a lower value was silently clamped to MINIMUM_BLOCK_RESERVED_WEIGHT.
2026-02-07 13:57:33 +01:00
Sjors Provoost
d3e49528d4 mining: fix -blockreservedweight shadows IPC option
The -blockreservedweight startup option should only affect RPC code,
because IPC clients (currently) do not have a way to signal their intent
to use the node default (the BlockCreateOptions struct defaults
merely document a recommendation for client software).

Before this commit however, if the user set -blockreservedweight
then ApplyArgsManOptions would cause the block_reserved_weight
option passed by IPC clients to be ignored. Users who don't set
this value were not affected.

Fix this by making BlockCreateOptions::block_reserved_weight an
std::optional.

Internal interface users, such as the RPC call sites, don't set a
value so -blockreservedweight is used. Whereas IPC clients do set
a value which is no longer ignored.

Test coverage is added.

mining_basic.py already ensured -blockreservedweight is enforced by
mining RPC methods. This commit adds coverage for Mining interface IPC
clients. It also verifies that -blockreservedweight has no effect on
them.

Co-Authored-By: Russell Yanofsky <russ@yanofsky.org>
2026-02-07 13:57:33 +01:00
Sjors Provoost
418b7995dd test: have mining template helpers return None
Refactor the mining_create_block_template and mining_wait_next_template
helpers in ipc_util.py to return None if they time out or fail. It makes
the test easier to read and provides a more clear error message in case
of a regression.

There were a few spots that didn't use mining_wait_next_template yet,
which now do.
2026-02-07 13:13:31 +01:00
Sjors Provoost
633d183119 test: misc interface_ipc_mining.py improvements
- share miniwallet and block create options between tests
- documentation fixes
- use assert_equal instead of assert ==
2026-02-06 15:46:31 +01:00
Sjors Provoost
52ccd9215e test: split interface_ipc_mining.py into subtests
Split the Mining interface test into focused subtests.

Keep the initial tip-change pre-mine check in run_mining_interface_test.
As a result run_block_template_test no longer has newblockref.
2026-02-06 15:46:31 +01:00
Sjors Provoost
4e49fa2a68 test: add interface_ipc_mining.py
Split Mining interface tests into interface_ipc_mining.py and keep
interface_ipc.py for echo + simple inspectors.

Register the new test in test_runner.py.

The setup code around "Create Mining proxy object" is duplicated
in the new test file, but the simple insector checks below it
are not moved.
2026-02-06 15:46:31 +01:00