* Called when a block is connected. Removes from mempool and updates the miner fee estimator. */
| 555 | * Called when a block is connected. Removes from mempool and updates the miner fee estimator. |
| 556 | */ |
| 557 | void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight) |
| 558 | { |
| 559 | LOCK(cs); |
| 560 | std::vector<const CTxMemPoolEntry*> entries; |
| 561 | for (const auto& tx : vtx) |
| 562 | { |
| 563 | uint256 hash = tx->GetHash(); |
| 564 | |
| 565 | indexed_transaction_set::iterator i = mapTx.find(hash); |
| 566 | if (i != mapTx.end()) |
| 567 | entries.push_back(&*i); |
| 568 | } |
| 569 | // Before the txs in the new block have been removed from the mempool, update policy estimates |
| 570 | if (minerPolicyEstimator) {minerPolicyEstimator->processBlock(nBlockHeight, entries);} |
| 571 | for (const auto& tx : vtx) |
| 572 | { |
| 573 | txiter it = mapTx.find(tx->GetHash()); |
| 574 | if (it != mapTx.end()) { |
| 575 | setEntries stage; |
| 576 | stage.insert(it); |
| 577 | RemoveStaged(stage, true, MemPoolRemovalReason::BLOCK); |
| 578 | } |
| 579 | removeConflicts(*tx); |
| 580 | ClearPrioritisation(tx->GetHash()); |
| 581 | } |
| 582 | lastRollingFeeUpdate = GetTime(); |
| 583 | blockSinceLastRollingFeeBump = true; |
| 584 | } |
| 585 | |
| 586 | void CTxMemPool::_clear() |
| 587 | { |