mining: store block create options in NodeContext

Read configured mining options once during startup instead of parsing
options like -blockmaxweight each time a block template is generated.

Store the parsed startup options as BlockCreateOptions. Members left unset
keep representing unset options; hardcoded defaults are applied by
FlattenMiningOptions() before the options are used. IPC overrides and node
defaults can then be merged with the same option type used by
BlockAssembler.

Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
Sjors Provoost
2026-05-18 14:17:29 +02:00
parent 4637cd157d
commit 3bb6498fb0
7 changed files with 56 additions and 11 deletions

View File

@@ -988,8 +988,7 @@ public:
// Also wait during the final catch-up moments after IBD.
if (!CooldownIfHeadersAhead(chainman(), notifications(), *maybe_tip, m_interrupt_mining)) return {};
}
const auto args_options{*Assert(ReadMiningArgs(*Assert(m_node.args)))};
const BlockCreateOptions create_options{MergeMiningOptions(options, args_options)};
const BlockCreateOptions create_options{MergeMiningOptions(options, m_node.mining_args)};
return std::make_unique<BlockTemplateImpl>(create_options,
BlockAssembler{
chainman().ActiveChainstate(),