| 1003 | } |
| 1004 | |
| 1005 | CTxMemPool::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 | |
| 1030 | void CTxMemPool::ChangeSet::StageRemoval(CTxMemPool::txiter it) |
| 1031 | { |