MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / removeForBlock

Method removeForBlock

src/txmempool.cpp:557–584  ·  view source on GitHub ↗

* Called when a block is connected. Removes from mempool and updates the miner fee estimator. */

Source from the content-addressed store, hash-verified

555 * Called when a block is connected. Removes from mempool and updates the miner fee estimator.
556 */
557void 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
586void CTxMemPool::_clear()
587{

Callers 3

ConnectTipMethod · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45

Calls 7

GetTimeFunction · 0.85
processBlockMethod · 0.80
GetHashMethod · 0.45
findMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
insertMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.36
BOOST_AUTO_TEST_CASEFunction · 0.36