39 mempool_limits.ancestor_count = argsman.GetIntArg("-limitancestorcount", mempool_limits.ancestor_count); 41 mempool_limits.descendant_count = argsman.GetIntArg("-limitdescendantcount", mempool_limits.descendant_count); 45 util::Result<void> ApplyArgsManOptions(const ArgsManager& argsman, const CChainParams& chainparams, MemPoolOptions& mempool_opts) 47 mempool_opts.check_ratio = argsman.GetIntArg("-checkmempool", mempool_opts.check_ratio); 49 if (auto mb = argsman.GetIntArg("-maxmempool")) { 50 constexpr bool is_32bit{sizeof(void*) == 4}; 51 if (is_32bit && *mb > MAX_32BIT_MEMPOOL_MB) { 52 return util::Error{Untranslated(strprintf("-maxmempool is set to %i but can't be over %i MB on 32-bit systems
", *mb, MAX_32BIT_MEMPOOL_MB))}; 54 mempool_opts.max_size_bytes = *mb * 1'000'000; 57 if (auto hours = argsman.GetIntArg("-mempoolexpiry
")) mempool_opts.expiry = std::chrono::hours{*hours}; 59 // incremental relay fee sets the minimum feerate increase necessary for replacement in the mempool 60 // and the amount the mempool min fee increases above the feerate of txs evicted due to mempool limiting. 61 if (const auto arg{argsman.GetArg("-incrementalrelayfee
")}) { 62 if (std::optional<CAmount> inc_relay_fee = ParseMoney(*arg)) { 63 mempool_opts.incremental_relay_feerate = CFeeRate{inc_relay_fee.value()}; 65 return util::Error{AmountErrMsg("incrementalrelayfee
", *arg)}; 69 static_assert(DEFAULT_MIN_RELAY_TX_FEE == DEFAULT_INCREMENTAL_RELAY_FEE); 70 if (const auto arg{argsman.GetArg("-minrelaytxfee
")}) { 71 if (std::optional<CAmount> min_relay_feerate = ParseMoney(*arg)) { 72 // High fee check is done afterward in CWallet::Create() 73 mempool_opts.min_relay_feerate = CFeeRate{min_relay_feerate.value()}; 75 return util::Error{AmountErrMsg("minrelaytxfee
", *arg)}; 77 } else if (mempool_opts.incremental_relay_feerate > mempool_opts.min_relay_feerate) { 78 // Allow only setting incremental fee to control both 79 mempool_opts.min_relay_feerate = mempool_opts.incremental_relay_feerate; 80 LogInfo("Increasing minrelaytxfee to %
s to match incrementalrelayfee
", mempool_opts.min_relay_feerate.ToString()); 83 // Feerate used to define dust. Shouldn't be changed lightly as old 84 // implementations may inadvertently create non-standard transactions 85 if (const auto arg{argsman.GetArg("-dustrelayfee
")}) { 86 if (std::optional<CAmount> parsed = ParseMoney(*arg)) { 87 mempool_opts.dust_relay_feerate = CFeeRate{parsed.value()}; 89 return util::Error{AmountErrMsg("dustrelayfee
", *arg)}; 93 mempool_opts.permit_bare_multisig = argsman.GetBoolArg("-permitbaremultisig
", DEFAULT_PERMIT_BAREMULTISIG); 95 if (argsman.GetBoolArg("-datacarrier
", DEFAULT_ACCEPT_DATACARRIER)) { 96 mempool_opts.max_datacarrier_bytes = argsman.GetIntArg("-datacarriersize
", MAX_OP_RETURN_RELAY); 98 mempool_opts.max_datacarrier_bytes = std::nullopt; 101 mempool_opts.require_standard = !argsman.GetBoolArg("-acceptnonstdtxn
", DEFAULT_ACCEPT_NON_STD_TXN); 102 if (!chainparams.IsTestChain() && !mempool_opts.require_standard) { 103 return util::Error{Untranslated(strprintf("acceptnonstdtxn is not currently supported
for %
s chain
", chainparams.GetChainTypeString()))}; 106 mempool_opts.persist_v1_dat = argsman.GetBoolArg("-persistmempoolv1
", mempool_opts.persist_v1_dat); 108 ApplyArgsManOptions(argsman, mempool_opts.limits); 110 if (mempool_opts.limits.cluster_count > MAX_CLUSTER_COUNT_LIMIT) { 111 return util::Error{Untranslated(strprintf("limitclustercount must be less than or equal to %d
", MAX_CLUSTER_COUNT_LIMIT))};
unsigned cluster_count
The maximum number of transactions in a cluster.
is a home for simple string functions returning descriptive messages that are used in RPC and GUI int...
Options struct containing limit options for a CTxMemPool.
int64_t cluster_size_vbytes
The maximum allowed size in virtual bytes of a cluster.
util::Result< void > ApplyArgsManOptions(const ArgsManager &argsman, const CChainParams &chainparams, MemPoolOptions &mempool_opts)
Overlay the options set in argsman on top of corresponding members in mempool_opts.
bilingual_str AmountErrMsg(const std::string &optname, const std::string &strValue)
static constexpr int MAX_32BIT_MEMPOOL_MB
Maximum mempool size on 32-bit systems.
int64_t GetIntArg(const std::string &strArg, int64_t nDefault) const
Options struct containing options for constructing a CTxMemPool.