mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
Avoid using mapTx.modify() to update modified fees
Now that the mempool no longer keeps any feerate-based indices, we can modify feerates in mempool entries directly.
This commit is contained in:
@@ -598,7 +598,7 @@ void CTxMemPool::PrioritiseTransaction(const Txid& hash, const CAmount& nFeeDelt
|
||||
if (it != mapTx.end()) {
|
||||
// PrioritiseTransaction calls stack on previous ones. Set the new
|
||||
// transaction fee to be current modified fee + feedelta.
|
||||
mapTx.modify(it, [&nFeeDelta](CTxMemPoolEntry& e) { e.UpdateModifiedFee(nFeeDelta); });
|
||||
it->UpdateModifiedFee(nFeeDelta);
|
||||
m_txgraph->SetTransactionFee(*it, it->GetModifiedFee());
|
||||
++nTransactionsUpdated;
|
||||
}
|
||||
@@ -975,7 +975,7 @@ CTxMemPool::ChangeSet::TxHandle CTxMemPool::ChangeSet::StageAddition(const CTran
|
||||
TxGraph::Ref ref(m_pool->m_txgraph->AddTransaction(FeePerWeight(fee, GetSigOpsAdjustedWeight(GetTransactionWeight(*tx), sigops_cost, ::nBytesPerSigOp))));
|
||||
auto newit = m_to_add.emplace(std::move(ref), tx, fee, time, entry_height, entry_sequence, spends_coinbase, sigops_cost, lp).first;
|
||||
if (delta) {
|
||||
m_to_add.modify(newit, [&delta](CTxMemPoolEntry& e) { e.UpdateModifiedFee(delta); });
|
||||
newit->UpdateModifiedFee(delta);
|
||||
m_pool->m_txgraph->SetTransactionFee(*newit, newit->GetModifiedFee());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user