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

Method StageAddition

src/txmempool.cpp:1005–1028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1003}
1004
1005CTxMemPool::ChangeSet::TxHandle CTxMemPool::ChangeSet::StageAddition(const CTransactionRef& tx, const CAmount fee, int64_t time, unsigned int entry_height, uint64_t entry_sequence, bool spends_coinbase, int64_t sigops_cost, LockPoints lp)
1006{
1007 LOCK(m_pool->cs);
1008 Assume(m_to_add.find(tx->GetHash()) == m_to_add.end());
1009 Assume(!m_dependencies_processed);
1010
1011 // We need to process dependencies after adding a new transaction.
1012 m_dependencies_processed = false;
1013
1014 CAmount delta{0};
1015 m_pool->ApplyDelta(tx->GetHash(), delta);
1016
1017 FeePerWeight feerate(fee, GetSigOpsAdjustedWeight(GetTransactionWeight(*tx), sigops_cost, ::nBytesPerSigOp));
1018 auto newit = m_to_add.emplace(tx, fee, time, entry_height, entry_sequence, spends_coinbase, sigops_cost, lp).first;
1019 m_pool->m_txgraph->AddTransaction(const_cast<CTxMemPoolEntry&>(*newit), feerate);
1020 if (delta) {
1021 newit->UpdateModifiedFee(delta);
1022 m_pool->m_txgraph->SetTransactionFee(*newit, newit->GetModifiedFee());
1023 }
1024
1025 m_entry_vec.push_back(newit);
1026
1027 return newit;
1028}
1029
1030void CTxMemPool::ChangeSet::StageRemoval(CTxMemPool::txiter it)
1031{

Callers 7

CheckPolicyLimitsMethod · 0.80
PreChecksMethod · 0.80
BOOST_FIXTURE_TEST_CASEFunction · 0.80
rbf.cppFile · 0.80
TryAddToMempoolFunction · 0.80
MockMempoolMinFeeFunction · 0.80
PopulateMempoolMethod · 0.80

Calls 12

GetSigOpsAdjustedWeightFunction · 0.85
GetTransactionWeightFunction · 0.85
findMethod · 0.80
ApplyDeltaMethod · 0.80
emplaceMethod · 0.80
UpdateModifiedFeeMethod · 0.80
GetHashMethod · 0.45
endMethod · 0.45
AddTransactionMethod · 0.45
SetTransactionFeeMethod · 0.45
GetModifiedFeeMethod · 0.45
push_backMethod · 0.45

Tested by 4

BOOST_FIXTURE_TEST_CASEFunction · 0.64
TryAddToMempoolFunction · 0.64
MockMempoolMinFeeFunction · 0.64
PopulateMempoolMethod · 0.64