Remove unused argument to RemoveStaged
What changed, and why it matters
This is a routine code cleanup: a function called RemoveStaged had an extra parameter (updateDescendants) that was no longer used, so it was removed from the function definition and every place that called it. There is no security-relevant change here.
No action needed; this is a non-functional refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit refactors CTxMemPool::RemoveStaged by dropping the bool updateDescendants parameter. All call sites previously passed either false or true, but the function body never actually used the argument; it simply called removeUnchecked for each staged entry. The patch updates the declaration, definition, and all callers accordingly. No behavior changes.
Changed components
src/txmempool.cppsrc/txmempool.hInspect captured patch +7 / −9
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index df90683a..7f259369 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -198,7 +198,7 @@ void CTxMemPool::Apply(ChangeSet* changeset)
AssertLockHeld(cs);
m_txgraph->CommitStaging();
- RemoveStaged(changeset->m_to_remove, false, MemPoolRemovalReason::REPLACED);
+ RemoveStaged(changeset->m_to_remove, MemPoolRemovalReason::REPLACED);
for (size_t i=0; i<changeset->m_entry_vec.size(); ++i) {
auto tx_entry = changeset->m_entry_vec[i];
@@ -336,7 +336,7 @@ void CTxMemPool::removeRecursive(const CTransaction &origTx, MemPoolRemovalReaso
CalculateDescendants(it, setAllRemoves);
}
- RemoveStaged(setAllRemoves, false, reason);
+ RemoveStaged(setAllRemoves, reason);
}
void CTxMemPool::removeForReorg(CChain& chain, std::function<bool(txiter)> check_final_and_mature)
@@ -354,7 +354,7 @@ void CTxMemPool::removeForReorg(CChain& chain, std::function<bool(txiter)> check
for (txiter it : txToRemove) {
CalculateDescendants(it, setAllRemoves);
}
- RemoveStaged(setAllRemoves, false, MemPoolRemovalReason::REORG);
+ RemoveStaged(setAllRemoves, MemPoolRemovalReason::REORG);
for (indexed_transaction_set::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) {
assert(TestLockPointValidity(chain, it->GetLockPoints()));
}
@@ -392,7 +392,7 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigne
setEntries stage;
stage.insert(it);
txs_removed_for_block.emplace_back(*it);
- RemoveStaged(stage, true, MemPoolRemovalReason::BLOCK);
+ RemoveStaged(stage, MemPoolRemovalReason::BLOCK);
}
removeConflicts(*tx);
ClearPrioritisation(tx->GetHash());
@@ -744,7 +744,7 @@ void CTxMemPool::RemoveUnbroadcastTx(const Txid& txid, const bool unchecked) {
}
}
-void CTxMemPool::RemoveStaged(setEntries &stage, bool updateDescendants, MemPoolRemovalReason reason) {
+void CTxMemPool::RemoveStaged(setEntries &stage, MemPoolRemovalReason reason) {
AssertLockHeld(cs);
for (txiter it : stage) {
removeUnchecked(it, reason);
@@ -776,7 +776,7 @@ int CTxMemPool::Expire(std::chrono::seconds time)
for (txiter removeit : toremove) {
CalculateDescendants(removeit, stage);
}
- RemoveStaged(stage, false, MemPoolRemovalReason::EXPIRY);
+ RemoveStaged(stage, MemPoolRemovalReason::EXPIRY);
return stage.size();
}
diff --git a/src/txmempool.h b/src/txmempool.h
index c305d5d4..064ea9ae 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -578,10 +578,8 @@ private:
* If a transaction is in this set, then all in-mempool descendants must
* also be in the set, unless this transaction is being removed for being
* in a block.
- * Set updateDescendants to true when removing a tx that was in a block, so
- * that any in-mempool descendants have their ancestor state updated.
*/
- void RemoveStaged(setEntries& stage, bool updateDescendants, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs);
+ void RemoveStaged(setEntries& stage, MemPoolRemovalReason reason) EXCLUSIVE_LOCKS_REQUIRED(cs);
/** Before calling removeUnchecked for a given transaction,
* UpdateForRemoveFromMempool must be called on the entire (dependent) set
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.