Eliminate CheckPackageLimits, which no longer does anything
What changed, and why it matters
This commit removes a function called CheckPackageLimits that, according to the commit title and message, no longer did anything useful. The function body simply returned success without performing any checks, and callers were already using other mechanisms (like CheckPolicyLimits) for the relevant limits. This is a straightforward code cleanup with no apparent security impact.
No security action required. Treat as normal refactoring/cleanup.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change deletes CTxMemPool::CheckPackageLimits() and its declaration, plus all call sites in src/node/interfaces.cpp and src/validation.cpp. The removed implementation was a stub that unconditionally returned util::Result
Changed components
src/node/interfaces.cppsrc/txmempool.cppsrc/txmempool.hsrc/validation.cppInspect captured patch +3 / −31
diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp
index 65997267..0506f00b 100644
--- a/src/node/interfaces.cpp
+++ b/src/node/interfaces.cpp
@@ -719,8 +719,7 @@ public:
if (!m_node.mempool->CheckPolicyLimits(tx)) {
return util::Error{Untranslated("too many unconfirmed transactions in cluster")};
}
- LOCK(m_node.mempool->cs);
- return m_node.mempool->CheckPackageLimits({tx}, GetVirtualTransactionSize(*tx));
+ return {};
}
CFeeRate estimateSmartFee(int num_blocks, bool conservative, FeeCalculation* calc) override
{
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 99b7d3ef..921765de 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -131,12 +131,6 @@ void CTxMemPool::UpdateTransactionsFromBlock(const std::vector<Txid>& vHashesToU
}
}
-util::Result<void> CTxMemPool::CheckPackageLimits(const Package& package,
- const int64_t total_vsize) const
-{
- return {};
-}
-
bool CTxMemPool::HasDescendants(const Txid& txid) const
{
LOCK(cs);
diff --git a/src/txmempool.h b/src/txmempool.h
index 437bdf4e..0c0ec241 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -436,21 +436,6 @@ public:
* more transactions as a DoS protection. */
std::vector<txiter> GatherClusters(const std::vector<Txid>& txids) const EXCLUSIVE_LOCKS_REQUIRED(cs);
- /** Calculate all in-mempool ancestors of a set of transactions not already in the mempool and
- * check ancestor and descendant limits. Heuristics are used to estimate the ancestor and
- * descendant count of all entries if the package were to be added to the mempool. The limits
- * are applied to the union of all package transactions. For example, if the package has 3
- * transactions and limits.ancestor_count = 25, the union of all 3 sets of ancestors (including the
- * transactions themselves) must be <= 22.
- * @param[in] package Transaction package being evaluated for acceptance
- * to mempool. The transactions need not be direct
- * ancestors/descendants of each other.
- * @param[in] total_vsize Sum of virtual sizes for all transactions in package.
- * @returns {} or the error reason if a limit is hit.
- */
- util::Result<void> CheckPackageLimits(const Package& package,
- int64_t total_vsize) const EXCLUSIVE_LOCKS_REQUIRED(cs);
-
/** Populate setDescendants with all in-mempool descendants of given transaction.
* Assumes that setDescendants includes all in-mempool descendants of anything
* already in it. */
diff --git a/src/validation.cpp b/src/validation.cpp
index 62b629d4..b2ea91e2 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1054,17 +1054,11 @@ bool MemPoolAccept::PackageMempoolChecks(const std::vector<CTransactionRef>& txn
AssertLockHeld(cs_main);
AssertLockHeld(m_pool.cs);
- // CheckPackageLimits expects the package transactions to not already be in the mempool.
- assert(std::all_of(txns.cbegin(), txns.cend(), [this](const auto& tx) { return !m_pool.exists(tx->GetHash()); }));
+ assert(std::all_of(txns.cbegin(), txns.cend(), [this](const auto& tx)
+ { return !m_pool.exists(tx->GetHash());}));
assert(txns.size() == workspaces.size());
- auto result = m_pool.CheckPackageLimits(txns, total_vsize);
- if (!result) {
- // This is a package-wide error, separate from an individual transaction error.
- return package_state.Invalid(PackageValidationResult::PCKG_POLICY, "package-mempool-limits", util::ErrorString(result).original);
- }
-
// No conflicts means we're finished. Further checks are all RBF-only.
if (!m_subpackage.m_rbf) return true;
Why this scored 15/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.