mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-28 18:19:31 +01:00
b623fab1bamining: enforce minimum reserved weight for IPC (Sjors Provoost)d3e49528d4mining: fix -blockreservedweight shadows IPC option (Sjors Provoost)418b7995ddtest: have mining template helpers return None (Sjors Provoost) Pull request description: Also enforce `MINIMUM_BLOCK_RESERVED_WEIGHT` for IPC clients. 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 PR 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, with a preliminary commit that refactors the `create_block_template` and `wait_next_template` helpers. `mining_basic.py` already ensured `-blockreservedweight` is enforced by mining RPC methods. The second commit adds coverage for Mining interface IPC clients. It also verifies that `-blockreservedweight` has no effect on them. The third commit enforces `MINIMUM_BLOCK_RESERVED_WEIGHT` for IPC clients. Previously lower values were quietly clamped. --- Merge order preference: #34452 should ideally go first. ACKs for top commit: sedited: Re-ACKb623fab1baryanofsky: Code review ACKb623fab1ba. Was rebased and test split up and comment updated since last review. ismaelsadeeq: ACKb623fab1baTree-SHA512: 9e651a520d8e4aeadb330da86788744b6ecad8060fa21d50dc8e6012a60083e7b262aaa08a64676b9ef18ba65b651bc1272d8383d184030342e4c0f2c6a9866d