Skip to content

Commit

Permalink
mempool, refactor: remove unused parameter from addUnchecked
Browse files Browse the repository at this point in the history
  • Loading branch information
ismaelsadeeq committed Oct 14, 2023
1 parent 19abb9d commit 76636c3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/txmempool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ void CTxMemPool::AddTransactionsUpdated(unsigned int n)
nTransactionsUpdated += n;
}

void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAncestors, bool validFeeEstimate)
void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, setEntries &setAncestors)
{
// Add to memory pool without checking anything.
// Used by AcceptToMemoryPool(), which DOES do
Expand Down Expand Up @@ -1055,10 +1055,10 @@ int CTxMemPool::Expire(std::chrono::seconds time)
return stage.size();
}

void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, bool validFeeEstimate)
void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry)
{
auto ancestors{AssumeCalculateMemPoolAncestors(__func__, entry, Limits::NoLimits())};
return addUnchecked(entry, ancestors, validFeeEstimate);
return addUnchecked(entry, ancestors);
}

void CTxMemPool::UpdateChild(txiter entry, txiter child, bool add)
Expand Down
4 changes: 2 additions & 2 deletions src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ class CTxMemPool
// Note that addUnchecked is ONLY called from ATMP outside of tests
// and any other callers may break wallet's in-mempool tracking (due to
// lack of CValidationInterface::TransactionAddedToMempool callbacks).
void addUnchecked(const CTxMemPoolEntry& entry, bool validFeeEstimate = true) EXCLUSIVE_LOCKS_REQUIRED(cs, cs_main);
void addUnchecked(const CTxMemPoolEntry& entry, setEntries& setAncestors, bool validFeeEstimate = true) EXCLUSIVE_LOCKS_REQUIRED(cs, cs_main);
void addUnchecked(const CTxMemPoolEntry& entry) EXCLUSIVE_LOCKS_REQUIRED(cs, cs_main);
void addUnchecked(const CTxMemPoolEntry& entry, setEntries& setAncestors) EXCLUSIVE_LOCKS_REQUIRED(cs, cs_main);

void removeRecursive(const CTransaction& tx, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs);
/** After reorg, filter the entries that would no longer be valid in the next block, and update
Expand Down
10 changes: 1 addition & 9 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1120,16 +1120,8 @@ bool MemPoolAccept::Finalize(const ATMPArgs& args, Workspace& ws)
}
m_pool.RemoveStaged(ws.m_all_conflicting, false, MemPoolRemovalReason::REPLACED);

// This transaction should only count for fee estimation if:
// - it's not being re-added during a reorg which bypasses typical mempool fee limits
// - the node is not behind
// - the transaction is not dependent on any other transactions in the mempool
// - it's not part of a package. Since package relay is not currently supported, this
// transaction has not necessarily been accepted to miners' mempools.
bool validForFeeEstimation = !bypass_limits && !args.m_package_submission && IsCurrentForFeeEstimation(m_active_chainstate) && m_pool.HasNoInputsOf(tx);

// Store transaction in memory
m_pool.addUnchecked(*entry, ws.m_ancestors, validForFeeEstimation);
m_pool.addUnchecked(*entry, ws.m_ancestors);

// trim mempool and check if tx was trimmed
// If we are validating a package, don't trim here because we could evict a previous transaction
Expand Down

0 comments on commit 76636c3

Please sign in to comment.