aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2022-06-06 17:14:39 -0400
committerCarl Dong <contact@carldong.me>2022-06-28 15:53:45 -0400
commit9a3d825c30e8e6118d74a4e568744cb9d03f7f5d (patch)
tree0b18725efed5617b13a42ae0aca3f24f1e165b0b /src
parent6c5c60c4124293d948735756f84efc85262ea66f (diff)
downloadbitcoin-9a3d825c30e8e6118d74a4e568744cb9d03f7f5d.tar.xz
init: Remove redundant -*mempool*, -limit* queries
Now that MemPoolOptions has correctly-determined max_size and limits members, perform sanity checks on that instead of re-determining the options.
Diffstat (limited to 'src')
-rw-r--r--src/init.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 9259745214..ea8d01a7fa 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -930,11 +930,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainparams.GetConsensus().nMinimumChainWork.GetHex());
}
- // mempool limits
- int64_t nMempoolSizeMax = args.GetIntArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE_MB) * 1000000;
- int64_t nMempoolSizeMin = args.GetIntArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT_KVB) * 1000 * 40;
- if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin)
- return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(nMempoolSizeMin / 1000000.0)));
// incremental relay fee sets the minimum feerate increase necessary for BIP 125 replacement in the mempool
// and the amount the mempool min fee increases above the feerate of txs evicted due to mempool limiting.
if (args.IsArgSet("-incrementalrelayfee")) {
@@ -1433,6 +1428,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
};
ApplyArgsManOptions(args, mempool_opts);
mempool_opts.check_ratio = std::clamp<int>(mempool_opts.check_ratio, 0, 1'000'000);
+
+ int64_t descendant_limit_bytes = mempool_opts.limits.descendant_size_vbytes * 40;
+ if (mempool_opts.max_size_bytes < 0 || mempool_opts.max_size_bytes < descendant_limit_bytes) {
+ return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(descendant_limit_bytes / 1'000'000.0)));
+ }
LogPrintf("* Using %.1f MiB for in-memory UTXO set (plus up to %.1f MiB of unused mempool space)\n", cache_sizes.coins * (1.0 / 1024 / 1024), mempool_opts.max_size_bytes * (1.0 / 1024 / 1024));
for (bool fLoaded = false; !fLoaded && !ShutdownRequested();) {