| 197 | }; |
| 198 | |
| 199 | void MiniMiner::DeleteAncestorPackage(const std::set<MockEntryMap::iterator, IteratorComparator>& ancestors) |
| 200 | { |
| 201 | Assume(ancestors.size() >= 1); |
| 202 | // "Mine" all transactions in this ancestor set. |
| 203 | for (auto& anc : ancestors) { |
| 204 | Assume(!m_in_block.contains(anc->first)); |
| 205 | m_in_block.insert(anc->first); |
| 206 | m_total_fees += anc->second.GetModifiedFee(); |
| 207 | m_total_vsize += anc->second.GetTxSize(); |
| 208 | auto it = m_descendant_set_by_txid.find(anc->first); |
| 209 | // Each entry’s descendant set includes itself |
| 210 | Assume(it != m_descendant_set_by_txid.end()); |
| 211 | for (auto& descendant : it->second) { |
| 212 | // If this fails, we must be double-deducting. Don't check fees because negative is possible. |
| 213 | Assume(descendant->second.GetSizeWithAncestors() >= anc->second.GetTxSize()); |
| 214 | descendant->second.UpdateAncestorState(-anc->second.GetTxSize(), -anc->second.GetModifiedFee()); |
| 215 | } |
| 216 | } |
| 217 | // Delete these entries. |
| 218 | for (const auto& anc : ancestors) { |
| 219 | m_descendant_set_by_txid.erase(anc->first); |
| 220 | // The above loop should have deducted each ancestor's size and fees from each of their |
| 221 | // respective descendants exactly once. |
| 222 | Assume(anc->second.GetModFeesWithAncestors() == 0); |
| 223 | Assume(anc->second.GetSizeWithAncestors() == 0); |
| 224 | auto vec_it = std::find(m_entries.begin(), m_entries.end(), anc); |
| 225 | Assume(vec_it != m_entries.end()); |
| 226 | m_entries.erase(vec_it); |
| 227 | m_entries_by_txid.erase(anc); |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | void MiniMiner::SanityCheck() const |
| 232 | { |
nothing calls this directly
no test coverage detected