Merge bitcoin/bitcoin#34235: miniminer: stop assuming ancestor fees >= self fees

2cade5d5d1 [miniminer] stop assuming ancestor fees >= self fees (glozow)

Pull request description:

  These assertions exist to detect double-deducting values when we update descendants. However, negative fees are possible with `prioritisetransaction` so it doesn't make sense to check this.

  Leave the check for sizes because those are never negative.

  Fixes #34234

ACKs for top commit:
  instagibbs:
    ACK 2cade5d5d1
  dergoegge:
    utACK 2cade5d5d1

Tree-SHA512: 935bbc8bd9a0d508eea43bb49aa43c22735e3f2c1012598f6843e229c13b76e44f9fd3eb8b61c437fa0b32353b4e7b15afa3e31002bdfa382d3d711d16419fde
This commit is contained in:
merge-script
2026-01-09 11:24:03 +00:00

View File

@@ -209,8 +209,7 @@ void MiniMiner::DeleteAncestorPackage(const std::set<MockEntryMap::iterator, Ite
// Each entrys descendant set includes itself
Assume(it != m_descendant_set_by_txid.end());
for (auto& descendant : it->second) {
// If these fail, we must be double-deducting.
Assume(descendant->second.GetModFeesWithAncestors() >= anc->second.GetModifiedFee());
// If this fails, we must be double-deducting. Don't check fees because negative is possible.
Assume(descendant->second.GetSizeWithAncestors() >= anc->second.GetTxSize());
descendant->second.UpdateAncestorState(-anc->second.GetTxSize(), -anc->second.GetModifiedFee());
}
@@ -234,10 +233,9 @@ void MiniMiner::SanityCheck() const
// m_entries, m_entries_by_txid, and m_descendant_set_by_txid all same size
Assume(m_entries.size() == m_entries_by_txid.size());
Assume(m_entries.size() == m_descendant_set_by_txid.size());
// Cached ancestor values should be at least as large as the transaction's own fee and size
// Cached ancestor values should be at least as large as the transaction's own size
Assume(std::all_of(m_entries.begin(), m_entries.end(), [](const auto& entry) {
return entry->second.GetSizeWithAncestors() >= entry->second.GetTxSize() &&
entry->second.GetModFeesWithAncestors() >= entry->second.GetModifiedFee();}));
return entry->second.GetSizeWithAncestors() >= entry->second.GetTxSize();}));
// None of the entries should be to-be-replaced transactions
Assume(std::all_of(m_to_be_replaced.begin(), m_to_be_replaced.end(),
[&](const auto& txid){ return !m_entries_by_txid.contains(txid); }));