What changed, and why it matters
This is a small internal code cleanup in Bitcoin Core's transaction memory pool. It rewrites a helper function called GetChildren so that it no longer builds a temporary set to remove duplicate child transactions; instead it uses a lightweight 'epoch' marker to skip duplicates. There is no user-facing change, no bug fix, and no security-relevant behavior change visible in the diff.
No security action required. Treat as routine refactoring; review for correctness only if auditing mempool behavior.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors CTxMemPool::GetChildren in src/txmempool.cpp. Previously the function collected child transaction iterators into a setEntries set (deduplicating by iterator) and then copied them into a result vector. The patch removes the set and instead uses the mempool’s existing WITH_FRESH_EPOCH / visited() mechanism to avoid adding the same child twice while iterating mapNextTx. The returned vector is unchanged in content and order is preserved (the original set also preserved order via a subsequent vector copy). This is a performance/cleanup change, not a consensus or security fix.
Changed components
src/txmempool.cppCTxMemPool::GetChildrenInspect captured patch +4 / −5
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 5fc1f3e8..1162634b 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -58,13 +58,12 @@ std::vector<CTxMemPoolEntry::CTxMemPoolEntryRef> CTxMemPool::GetChildren(const C
{
LOCK(cs);
std::vector<CTxMemPoolEntry::CTxMemPoolEntryRef> ret;
- setEntries children;
+ WITH_FRESH_EPOCH(m_epoch);
auto iter = mapNextTx.lower_bound(COutPoint(entry.GetTx().GetHash(), 0));
for (; iter != mapNextTx.end() && iter->first->hash == entry.GetTx().GetHash(); ++iter) {
- children.insert(iter->second);
- }
- for (const auto& child : children) {
- ret.emplace_back(*child);
+ if (!visited(iter->second)) {
+ ret.emplace_back(*(iter->second));
+ }
}
return ret;
}
Why this scored 11/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.