Remove dependency on cached ancestor data in mini-miner
What changed, and why it matters
This small code change updates an internal Bitcoin mining-simulation tool so it calculates ancestor transaction data on the spot rather than relying on a precomputed cache. The change appears aimed at preventing the mini-miner from using stale or incorrect cached values, which could lead to wrong fee estimates when simulating which transactions to include in a block. There is no direct evidence in the commit that this fixes an active security vulnerability, but it removes a dependency that could produce inconsistent results.
Treat as a correctness/hardening improvement rather than an urgent security fix. Review whether the cached ancestor values could ever diverge from reality in a way that affects miner profitability or block template validity, and consider backporting if the stale-cache risk exists in supported release branches. No immediate incident response is indicated by the diff alone.
Security signals we found
Removal of dependency on cached mempool ancestor metadata
Potential stale-cache / inconsistent-state concern in mining simulation
Change touches block-template / mining-path code (mini-miner)
No explicit security framing or CVE reference in commit
Evidence from the diff
In src/node/mini_miner.cpp, the MiniMiner constructor previously initialized MiniMinerMempoolEntry fields vsize_ancestor and fee_ancestor from the mempool entry’s cached values (GetSizeWithAncestors() and GetModFeesWithAncestors()). The patch replaces those cached reads with a fresh call to mempool.CalculateAncestorData(*txiter), then uses the returned ancestor_size and ancestor_fee. This eliminates reliance on cached ancestor state, likely to avoid inconsistencies if the cache is not updated or is invalidated during replacement/RBF scenarios.
Changed components
src/node/mini_miner.cppMiniMiner constructorMiniMinerMempoolEntry ancestor fee/size initializationInspect captured patch +3 / −2
diff --git a/src/node/mini_miner.cpp b/src/node/mini_miner.cpp
index a1c2edcb..b70c7503 100644
--- a/src/node/mini_miner.cpp
+++ b/src/node/mini_miner.cpp
@@ -74,12 +74,13 @@ MiniMiner::MiniMiner(const CTxMemPool& mempool, const std::vector<COutPoint>& ou
// Add every entry to m_entries_by_txid and m_entries, except the ones that will be replaced.
for (const auto& txiter : cluster) {
if (!m_to_be_replaced.count(txiter->GetTx().GetHash())) {
+ auto [ancestor_count, ancestor_size, ancestor_fee] = mempool.CalculateAncestorData(*txiter);
auto [mapiter, success] = m_entries_by_txid.emplace(txiter->GetTx().GetHash(),
MiniMinerMempoolEntry{/*tx_in=*/txiter->GetSharedTx(),
/*vsize_self=*/txiter->GetTxSize(),
- /*vsize_ancestor=*/txiter->GetSizeWithAncestors(),
+ /*vsize_ancestor=*/int64_t(ancestor_size),
/*fee_self=*/txiter->GetModifiedFee(),
- /*fee_ancestor=*/txiter->GetModFeesWithAncestors()});
+ /*fee_ancestor=*/ancestor_fee});
m_entries.push_back(mapiter);
} else {
auto outpoints_it = m_requested_outpoints_by_txid.find(txiter->GetTx().GetHash());
Why this scored 27/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.