Eliminate CheckPackageLimits, which no longer does anything

This commit is contained in:
Suhas Daftuar
2025-01-25 11:30:50 -05:00
parent 3a646ec462
commit 1902111e0f
4 changed files with 3 additions and 31 deletions

View File

@@ -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
{

View File

@@ -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);

View File

@@ -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. */

View File

@@ -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;