Use cluster size limit for -maxmempool bound, and allow -maxmempool=0 in general
What changed, and why it matters
This commit adjusts a startup configuration check for Bitcoin Core's memory pool (mempool) size. It changes the internal sanity check so that the minimum allowed -maxmempool value is based on the newer 'cluster size limit' rather than the older 'descendant size limit', and it explicitly allows users to set -maxmempool=0 to disable the mempool. This is a routine consistency fix for configuration validation logic, not a security patch for an exploitable vulnerability.
No security action required. Treat as a normal code/maintenance review if this commit is in your deployment path; ensure the relaxed -maxmempool=0 behavior matches operational expectations.
Security signals we found
Configuration validation logic changed
No memory safety, cryptographic, or network consensus changes
No input parsing or authorization changes
No incident or exploit references present in commit or supplied references
Evidence from the diff
The patch modifies CTxMemPool::Options flattening in src/txmempool.cpp. Previously the startup check computed descendant_limit_bytes = opts.limits.descendant_size_vbytes * 40 and rejected -maxmempool below that bound. It now computes cluster_limit_bytes = opts.limits.cluster_size_vbytes * 40 and uses that as the lower bound. The condition is also relaxed so that max_size_bytes == 0 is accepted (previously only allowed when descendant limit was 0). The functional test feature_dbcrash.py is updated to remove the now-unnecessary -limitdescendantsize=0 argument when using -maxmempool=0.
Changed components
src/txmempool.cpptest/functional/feature_dbcrash.pyInspect captured patch +3 / −4
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 5a46a029..df90683a 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<int>(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 c3008970..0c2059d1 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",
]
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.