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

Method removeForBlock

src/txmempool.cpp:583–609  ·  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

581 * Called when a block is connected. Removes from mempool and updates the miner fee estimator.
582 */
583void 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
611void CTxMemPool::_clear()
612{

Callers 3

ConnectTipFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 1

processBlockMethod · 0.80

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.64
BOOST_AUTO_TEST_CASEFunction · 0.64