* Called when a block is connected. Removes from mempool and updates the miner fee estimator. */
| 581 | * Called when a block is connected. Removes from mempool and updates the miner fee estimator. |
| 582 | */ |
| 583 | void CTxMemPool::removeForBlock(const std::vector<CTransaction>& vtx, unsigned int nBlockHeight, |
| 584 | std::list<CTransaction>& conflicts, bool fCurrentEstimate) |
| 585 | { |
| 586 | LOCK(cs); |
| 587 | std::vector<CTxMemPoolEntry> entries; |
| 588 | BOOST_FOREACH(const CTransaction& tx, vtx) |
| 589 | { |
| 590 | uint256 hash = tx.GetHash(); |
| 591 | |
| 592 | indexed_transaction_set::iterator i = mapTx.find(hash); |
| 593 | if (i != mapTx.end()) |
| 594 | entries.push_back(*i); |
| 595 | } |
| 596 | BOOST_FOREACH(const CTransaction& tx, vtx) |
| 597 | { |
| 598 | txiter it = mapTx.find(tx.GetHash()); |
| 599 | if (it != mapTx.end()) { |
| 600 | setEntries stage; |
| 601 | stage.insert(it); |
| 602 | RemoveStaged(stage, true); |
| 603 | } |
| 604 | removeConflicts(tx, conflicts); |
| 605 | ClearPrioritisation(tx.GetHash()); |
| 606 | } |
| 607 | // After the txs in the new block have been removed from the mempool, update policy estimates |
| 608 | minerPolicyEstimator->processBlock(nBlockHeight, entries, fCurrentEstimate); |
| 609 | } |
| 610 | |
| 611 | void CTxMemPool::_clear() |
| 612 | { |