Skip to content

Commit 9a3d825

Browse files
committed
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.
1 parent 6c5c60c commit 9a3d825

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/init.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -930,11 +930,6 @@ bool AppInitParameterInteraction(const ArgsManager& args, bool use_syscall_sandb
930930
LogPrintf("Warning: nMinimumChainWork set below default value of %s\n", chainparams.GetConsensus().nMinimumChainWork.GetHex());
931931
}
932932

933-
// mempool limits
934-
int64_t nMempoolSizeMax = args.GetIntArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE_MB) * 1000000;
935-
int64_t nMempoolSizeMin = args.GetIntArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT_KVB) * 1000 * 40;
936-
if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin)
937-
return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(nMempoolSizeMin / 1000000.0)));
938933
// incremental relay fee sets the minimum feerate increase necessary for BIP 125 replacement in the mempool
939934
// and the amount the mempool min fee increases above the feerate of txs evicted due to mempool limiting.
940935
if (args.IsArgSet("-incrementalrelayfee")) {
@@ -1433,6 +1428,11 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
14331428
};
14341429
ApplyArgsManOptions(args, mempool_opts);
14351430
mempool_opts.check_ratio = std::clamp<int>(mempool_opts.check_ratio, 0, 1'000'000);
1431+
1432+
int64_t descendant_limit_bytes = mempool_opts.limits.descendant_size_vbytes * 40;
1433+
if (mempool_opts.max_size_bytes < 0 || mempool_opts.max_size_bytes < descendant_limit_bytes) {
1434+
return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(descendant_limit_bytes / 1'000'000.0)));
1435+
}
14361436
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));
14371437

14381438
for (bool fLoaded = false; !fLoaded && !ShutdownRequested();) {

0 commit comments

Comments
 (0)