doc: add comment to explain correctness of GatherClusters()
What changed, and why it matters
This commit only adds a code comment explaining that a function returns results in a deterministic order. No code behavior was changed, so it cannot introduce or fix a security issue on its own.
No action required; this is a documentation-only change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds a three-line inline comment in CTxMemPool::GatherClusters() noting that TxGraph::GetCluster returns entries in deterministic graph order when the graph is not being modified. There are no logic, control-flow, or data changes.
Changed components
src/txmempool.cppInspect captured patch +3 / −0
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 7f315a3b..e0d16a81 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -957,6 +957,9 @@ std::vector<CTxMemPool::txiter> CTxMemPool::GatherClusters(const std::vector<Txi
for (auto txid : txids) {
auto it = mapTx.find(txid);
if (it != mapTx.end()) {
+ // Note that TxGraph::GetCluster will return results in graph
+ // order, which is deterministic (as long as we are not modifying
+ // the graph).
auto cluster = m_txgraph->GetCluster(*it, TxGraph::Level::MAIN);
if (unique_cluster_representatives.insert(static_cast<const CTxMemPoolEntry*>(&(**cluster.begin()))).second) {
for (auto tx : cluster) {
Why this scored 15/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.