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

Method removeForBlock

src/txmempool.cpp:405–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight)
406{
407 // Remove confirmed txs and conflicts when a new block is connected, updating the fee logic
408 AssertLockHeld(cs);
409 Assume(!m_have_changeset);
410 std::vector<RemovedMempoolTransactionInfo> txs_removed_for_block;
411 if (mapTx.size() || mapNextTx.size() || mapDeltas.size()) {
412 txs_removed_for_block.reserve(vtx.size());
413 for (const auto& tx : vtx) {
414 txiter it = mapTx.find(tx->GetHash());
415 if (it != mapTx.end()) {
416 txs_removed_for_block.emplace_back(*it);
417 removeUnchecked(it, MemPoolRemovalReason::BLOCK);
418 }
419 removeConflicts(*tx);
420 ClearPrioritisation(tx->GetHash());
421 }
422 }
423 if (m_opts.signals) {
424 m_opts.signals->MempoolTransactionsRemovedForBlock(txs_removed_for_block, nBlockHeight);
425 }
426 lastRollingFeeUpdate = GetTime();
427 blockSinceLastRollingFeeBump = true;
428 if (!m_txgraph->DoWork(/*max_cost=*/POST_CHANGE_COST)) {
429 LogDebug(BCLog::MEMPOOL, "Mempool in non-optimal ordering after block.");
430 }
431}
432
433void CTxMemPool::check(const CCoinsViewCache& active_coins_tip, int64_t spendheight) const
434{

Callers 1

ConnectTipMethod · 0.45

Calls 9

findMethod · 0.80
DoWorkMethod · 0.80
GetTimeFunction · 0.50
sizeMethod · 0.45
reserveMethod · 0.45
GetHashMethod · 0.45
endMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected