From 6a5e88e5cf06a6b410486cc36aba7afece0d9da9 Mon Sep 17 00:00:00 2001 From: stickies-v Date: Mon, 16 Jan 2023 18:04:09 +0000 Subject: [PATCH] miner: don't re-apply default Options value if argument is unset ApplyArgsManOptions does not need to set default values for missing arguments, these are already defined in the BlockAssembler::Options. This commit changes the interface of ApplyArgsManOptions(). If ApplyArgsManOptions() is called again after a option is changed, this option will no longer be reset to the default value. There is no observed behaviour change due to how ApplyArgsManOptions() is currently used, and the new interface is consistent with e.g. ValidationCacheSizes and MemPoolLimits. --- src/node/miner.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/node/miner.cpp b/src/node/miner.cpp index a337771f53e..c7bc9a9a3d1 100644 --- a/src/node/miner.cpp +++ b/src/node/miner.cpp @@ -74,13 +74,9 @@ BlockAssembler::BlockAssembler(Chainstate& chainstate, const CTxMemPool* mempool void ApplyArgsManOptions(const ArgsManager& args, BlockAssembler::Options& options) { // Block resource limits - // If -blockmaxweight is not given, limit to DEFAULT_BLOCK_MAX_WEIGHT - options.nBlockMaxWeight = args.GetIntArg("-blockmaxweight", DEFAULT_BLOCK_MAX_WEIGHT); - if (args.IsArgSet("-blockmintxfee")) { - std::optional parsed = ParseMoney(args.GetArg("-blockmintxfee", "")); - options.blockMinFeeRate = CFeeRate{parsed.value_or(DEFAULT_BLOCK_MIN_TX_FEE)}; - } else { - options.blockMinFeeRate = CFeeRate{DEFAULT_BLOCK_MIN_TX_FEE}; + options.nBlockMaxWeight = args.GetIntArg("-blockmaxweight", options.nBlockMaxWeight); + if (const auto blockmintxfee{args.GetArg("-blockmintxfee")}) { + if (const auto parsed{ParseMoney(*blockmintxfee)}) options.blockMinFeeRate = CFeeRate{*parsed}; } } static BlockAssembler::Options ConfiguredOptions()