0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-03-06 14:19:59 -05:00

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.
This commit is contained in:
stickies-v 2023-01-16 18:04:09 +00:00
parent ea72c3d9d5
commit 6a5e88e5cf
No known key found for this signature in database
GPG key ID: 5CB1CE6E5E66A757

View file

@ -74,13 +74,9 @@ BlockAssembler::BlockAssembler(Chainstate& chainstate, const CTxMemPool* mempool
void ApplyArgsManOptions(const ArgsManager& args, BlockAssembler::Options& options) void ApplyArgsManOptions(const ArgsManager& args, BlockAssembler::Options& options)
{ {
// Block resource limits // Block resource limits
// If -blockmaxweight is not given, limit to DEFAULT_BLOCK_MAX_WEIGHT options.nBlockMaxWeight = args.GetIntArg("-blockmaxweight", options.nBlockMaxWeight);
options.nBlockMaxWeight = args.GetIntArg("-blockmaxweight", DEFAULT_BLOCK_MAX_WEIGHT); if (const auto blockmintxfee{args.GetArg("-blockmintxfee")}) {
if (args.IsArgSet("-blockmintxfee")) { if (const auto parsed{ParseMoney(*blockmintxfee)}) options.blockMinFeeRate = CFeeRate{*parsed};
std::optional<CAmount> 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};
} }
} }
static BlockAssembler::Options ConfiguredOptions() static BlockAssembler::Options ConfiguredOptions()