Skip to content

Commit 6a5e88e

Browse files
committed
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.
1 parent ea72c3d commit 6a5e88e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/node/miner.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,9 @@ BlockAssembler::BlockAssembler(Chainstate& chainstate, const CTxMemPool* mempool
7474
void ApplyArgsManOptions(const ArgsManager& args, BlockAssembler::Options& options)
7575
{
7676
// Block resource limits
77-
// If -blockmaxweight is not given, limit to DEFAULT_BLOCK_MAX_WEIGHT
78-
options.nBlockMaxWeight = args.GetIntArg("-blockmaxweight", DEFAULT_BLOCK_MAX_WEIGHT);
79-
if (args.IsArgSet("-blockmintxfee")) {
80-
std::optional<CAmount> parsed = ParseMoney(args.GetArg("-blockmintxfee", ""));
81-
options.blockMinFeeRate = CFeeRate{parsed.value_or(DEFAULT_BLOCK_MIN_TX_FEE)};
82-
} else {
83-
options.blockMinFeeRate = CFeeRate{DEFAULT_BLOCK_MIN_TX_FEE};
77+
options.nBlockMaxWeight = args.GetIntArg("-blockmaxweight", options.nBlockMaxWeight);
78+
if (const auto blockmintxfee{args.GetArg("-blockmintxfee")}) {
79+
if (const auto parsed{ParseMoney(*blockmintxfee)}) options.blockMinFeeRate = CFeeRate{*parsed};
8480
}
8581
}
8682
static BlockAssembler::Options ConfiguredOptions()

0 commit comments

Comments
 (0)