Skip to content

Commit

Permalink
Remove RemoveStagedImpl and UpdateForRemoveFromMemPoolImpl as we have
Browse files Browse the repository at this point in the history
updated dependents which required to use it generically.
  • Loading branch information
JeremyRubin committed Oct 26, 2019
1 parent 49a5a05 commit 5681b04
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
21 changes: 2 additions & 19 deletions src/txmempool.cpp
Expand Up @@ -265,9 +265,7 @@ void CTxMemPool::UpdateChildrenForRemoval(txiter it)
}
}

template <typename T>
void CTxMemPool::UpdateForRemoveFromMempoolImpl(const T &entriesToRemove, bool updateDescendants)
{
void CTxMemPool::UpdateForRemoveFromMempool(const vecEntries &entriesToRemove, bool updateDescendants) {
// For each entry, walk back all ancestors and decrement size associated with this
// transaction
const uint64_t nNoLimit = std::numeric_limits<uint64_t>::max();
Expand Down Expand Up @@ -322,13 +320,6 @@ void CTxMemPool::UpdateForRemoveFromMempoolImpl(const T &entriesToRemove, bool u
UpdateChildrenForRemoval(removeIt);
}
}
void CTxMemPool::UpdateForRemoveFromMempool(const vecEntries &entriesToRemove, bool updateDescendants) {
UpdateForRemoveFromMempoolImpl(entriesToRemove, updateDescendants);
}

void CTxMemPool::UpdateForRemoveFromMempool(const setEntries &entriesToRemove, bool updateDescendants) {
UpdateForRemoveFromMempoolImpl(entriesToRemove, updateDescendants);
}

void CTxMemPoolEntry::UpdateDescendantState(int64_t modifySize, CAmount modifyFee, int64_t modifyCount)
{
Expand Down Expand Up @@ -961,22 +952,14 @@ size_t CTxMemPool::DynamicMemoryUsage() const {
return memusage::MallocUsage(sizeof(CTxMemPoolEntry) + 12 * sizeof(void*)) * mapTx.size() + memusage::DynamicUsage(mapNextTx) + memusage::DynamicUsage(mapDeltas) + memusage::DynamicUsage(mapLinks) + memusage::DynamicUsage(vTxHashes) + cachedInnerUsage;
}

template<typename T>
void CTxMemPool::RemoveStagedImpl(T &stage, bool updateDescendants, MemPoolRemovalReason reason) {
void CTxMemPool::RemoveStaged(vecEntries &stage, bool updateDescendants, MemPoolRemovalReason reason) {
AssertLockHeld(cs);
UpdateForRemoveFromMempool(stage, updateDescendants);
for (txiter it : stage) {
removeUnchecked(it, reason);
}
}

void CTxMemPool::RemoveStaged(vecEntries &stage, bool updateDescendants, MemPoolRemovalReason reason) {
RemoveStagedImpl(stage, updateDescendants, reason);
}
void CTxMemPool::RemoveStaged(setEntries &stage, bool updateDescendants, MemPoolRemovalReason reason) {
RemoveStagedImpl(stage, updateDescendants, reason);
}

int CTxMemPool::Expire(std::chrono::seconds time)
{
AssertLockHeld(cs);
Expand Down
6 changes: 0 additions & 6 deletions src/txmempool.h
Expand Up @@ -624,10 +624,7 @@ class CTxMemPool
* Set updateDescendants to true when removing a tx that was in a block, so
* that any in-mempool descendants have their ancestor state updated.
*/
template <typename T>
void RemoveStagedImpl(T& stage, bool updateDescendants, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs);
void RemoveStaged(vecEntries& stage, bool updateDescendants, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs);
void RemoveStaged(setEntries& stage, bool updateDescendants, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs);

/** When adding transactions from a disconnected block back to the mempool,
* new mempool entries may have children in the mempool (which is generally
Expand Down Expand Up @@ -750,10 +747,7 @@ class CTxMemPool
/** For each transaction being removed, update ancestors and any direct children.
* If updateDescendants is true, then also update in-mempool descendants'
* ancestor state. */
template <typename T>
void UpdateForRemoveFromMempoolImpl(const T &entriesToRemove, bool updateDescendants) EXCLUSIVE_LOCKS_REQUIRED(cs);
void UpdateForRemoveFromMempool(const vecEntries& entriesToRemove, bool updateDescendants) EXCLUSIVE_LOCKS_REQUIRED(cs);
void UpdateForRemoveFromMempool(const setEntries& entriesToRemove, bool updateDescendants) EXCLUSIVE_LOCKS_REQUIRED(cs);
/** Sever link between specified transaction and direct children. */
void UpdateChildrenForRemoval(txiter entry) EXCLUSIVE_LOCKS_REQUIRED(cs);

Expand Down

0 comments on commit 5681b04

Please sign in to comment.