From 17cf9ff7efdbab07644fc2f9017fcac1b0757c38 Mon Sep 17 00:00:00 2001 From: Suhas Daftuar Date: Tue, 11 Nov 2025 15:51:38 -0500 Subject: [PATCH] Use cluster size limit for -maxmempool bound, and allow -maxmempool=0 in general Previously we would sanity check the -maxmempool configuration based on a multiple of the descendant size limit, but with cluster mempool the maximum evicted size is now the cluster size limit, so use that instead. Also allow -maxmempool=0 in general (and not just if -limitdescendantsize/-limitclustersize is set to 0). --- src/txmempool.cpp | 6 +++--- test/functional/feature_dbcrash.py | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 5a46a029cdc..df90683a406 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -164,9 +164,9 @@ CTxMemPool::setEntries CTxMemPool::CalculateMemPoolAncestors(const CTxMemPoolEnt static CTxMemPool::Options&& Flatten(CTxMemPool::Options&& opts, bilingual_str& error) { opts.check_ratio = std::clamp(opts.check_ratio, 0, 1'000'000); - int64_t descendant_limit_bytes = opts.limits.descendant_size_vbytes * 40; - if (opts.max_size_bytes < 0 || opts.max_size_bytes < descendant_limit_bytes) { - error = strprintf(_("-maxmempool must be at least %d MB"), std::ceil(descendant_limit_bytes / 1'000'000.0)); + int64_t cluster_limit_bytes = opts.limits.cluster_size_vbytes * 40; + if (opts.max_size_bytes < 0 || (opts.max_size_bytes > 0 && opts.max_size_bytes < cluster_limit_bytes)) { + error = strprintf(_("-maxmempool must be at least %d MB"), std::ceil(cluster_limit_bytes / 1'000'000.0)); } return std::move(opts); } diff --git a/test/functional/feature_dbcrash.py b/test/functional/feature_dbcrash.py index c3008970956..0c2059d165f 100755 --- a/test/functional/feature_dbcrash.py +++ b/test/functional/feature_dbcrash.py @@ -53,7 +53,6 @@ class ChainstateWriteCrashTest(BitcoinTestFramework): # Set -maxmempool=0 to turn off mempool memory sharing with dbcache self.base_args = [ - "-limitdescendantsize=0", "-maxmempool=0", "-dbbatchsize=200000", ]