Remove unused limits from CalculateMemPoolAncestors

This commit is contained in:
Suhas Daftuar
2023-10-14 21:15:06 -04:00
parent 08be765ac2
commit 0402e6c780
6 changed files with 29 additions and 56 deletions

View File

@@ -306,21 +306,14 @@ private:
/**
* Helper function to calculate all in-mempool ancestors of staged_ancestors and apply ancestor
* and descendant limits (including staged_ancestors themselves, entry_size and entry_count).
* Helper function to calculate all in-mempool ancestors of staged_ancestors
*
* @param[in] entry_size Virtual size to include in the limits.
* @param[in] entry_count How many entries to include in the limits.
* @param[in] staged_ancestors Should contain entries in the mempool.
* @param[in] limits Maximum number and size of ancestors and descendants
*
* @return all in-mempool ancestors, or an error if any ancestor or descendant limits were hit
*/
util::Result<setEntries> CalculateAncestorsAndCheckLimits(int64_t entry_size,
size_t entry_count,
CTxMemPoolEntry::Parents &staged_ancestors,
const Limits& limits
) const EXCLUSIVE_LOCKS_REQUIRED(cs);
util::Result<setEntries> CalculateAncestors(CTxMemPoolEntry::Parents &staged_ancestors)
const EXCLUSIVE_LOCKS_REQUIRED(cs);
static TxMempoolInfo GetInfo(CTxMemPool::indexed_transaction_set::const_iterator it)
{
@@ -437,15 +430,13 @@ public:
* (these are all calculated including the tx itself)
*
* @param[in] entry CTxMemPoolEntry of which all in-mempool ancestors are calculated
* @param[in] limits Maximum number and size of ancestors and descendants
* @param[in] fSearchForParents Whether to search a tx's vin for in-mempool parents, or look
* up parents from mapLinks. Must be true for entries not in
* the mempool
*
* @return all in-mempool ancestors, or an error if any ancestor or descendant limits were hit
* @return all in-mempool ancestors
*/
util::Result<setEntries> CalculateMemPoolAncestors(const CTxMemPoolEntry& entry,
const Limits& limits,
bool fSearchForParents = true) const EXCLUSIVE_LOCKS_REQUIRED(cs);
/**
@@ -465,7 +456,6 @@ public:
setEntries AssumeCalculateMemPoolAncestors(
std::string_view calling_fn_name,
const CTxMemPoolEntry &entry,
const Limits& limits,
bool fSearchForParents = true) const EXCLUSIVE_LOCKS_REQUIRED(cs);
bool HasDescendants(const Txid& txid) const;
@@ -729,7 +719,7 @@ public:
/** Check if any cluster limits are exceeded. Returns true if pass, false if fail. */
bool CheckMemPoolPolicyLimits();
util::Result<CTxMemPool::setEntries> CalculateMemPoolAncestors(TxHandle tx, const Limits& limits)
util::Result<CTxMemPool::setEntries> CalculateMemPoolAncestors(TxHandle tx)
{
// Look up transaction in our cache first
auto it = m_ancestors.find(tx);
@@ -738,7 +728,7 @@ public:
// If not found, try to have the mempool calculate it, and cache
// for later.
LOCK(m_pool->cs);
auto ret{m_pool->CalculateMemPoolAncestors(*tx, limits)};
auto ret{m_pool->CalculateMemPoolAncestors(*tx)};
if (ret) m_ancestors.try_emplace(tx, *ret);
return ret;
}