Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 411 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
void CTxMemPool::AddTransactionsUpdated(unsigned int n) { | void CTxMemPool::AddTransactionsUpdated(unsigned int n) { | ||||
nTransactionsUpdated += n; | nTransactionsUpdated += n; | ||||
} | } | ||||
void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, | void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, | ||||
setEntries &setAncestors) { | setEntries &setAncestors) { | ||||
NotifyEntryAdded(entry.GetSharedTx()); | |||||
// Add to memory pool without checking anything. | // Add to memory pool without checking anything. | ||||
// Used by AcceptToMemoryPool(), which DOES do all the appropriate checks. | // Used by AcceptToMemoryPool(), which DOES do all the appropriate checks. | ||||
indexed_transaction_set::iterator newit = mapTx.insert(entry).first; | indexed_transaction_set::iterator newit = mapTx.insert(entry).first; | ||||
mapLinks.insert(make_pair(newit, TxLinks())); | mapLinks.insert(make_pair(newit, TxLinks())); | ||||
// Update transaction for any feeDelta created by PrioritiseTransaction | // Update transaction for any feeDelta created by PrioritiseTransaction | ||||
// TODO: refactor so that the fee delta is calculated before inserting into | // TODO: refactor so that the fee delta is calculated before inserting into | ||||
// mapTx. | // mapTx. | ||||
Show All 31 Lines | void CTxMemPool::addUnchecked(const CTxMemPoolEntry &entry, | ||||
nTransactionsUpdated++; | nTransactionsUpdated++; | ||||
totalTxSize += entry.GetTxSize(); | totalTxSize += entry.GetTxSize(); | ||||
vTxHashes.emplace_back(tx.GetHash(), newit); | vTxHashes.emplace_back(tx.GetHash(), newit); | ||||
newit->vTxHashesIdx = vTxHashes.size() - 1; | newit->vTxHashesIdx = vTxHashes.size() - 1; | ||||
} | } | ||||
void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) { | void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) { | ||||
CTransactionRef ptx = it->GetSharedTx(); | |||||
NotifyEntryRemoved(ptx, reason); | |||||
if (reason != MemPoolRemovalReason::BLOCK) { | if (reason != MemPoolRemovalReason::BLOCK) { | ||||
// Notify clients that a transaction has been removed from the mempool | // Notify clients that a transaction has been removed from the mempool | ||||
// for any reason except being included in a block. Clients interested | // for any reason except being included in a block. Clients interested | ||||
// in transactions included in blocks can subscribe to the | // in transactions included in blocks can subscribe to the | ||||
// BlockConnected notification. | // BlockConnected notification. | ||||
GetMainSignals().TransactionRemovedFromMempool(ptx); | GetMainSignals().TransactionRemovedFromMempool(it->GetSharedTx()); | ||||
} | } | ||||
NotifyEntryRemoved(it->GetSharedTx(), reason); | |||||
for (const CTxIn &txin : it->GetTx().vin) { | for (const CTxIn &txin : it->GetTx().vin) { | ||||
mapNextTx.erase(txin.prevout); | mapNextTx.erase(txin.prevout); | ||||
} | } | ||||
if (vTxHashes.size() > 1) { | if (vTxHashes.size() > 1) { | ||||
vTxHashes[it->vTxHashesIdx] = std::move(vTxHashes.back()); | vTxHashes[it->vTxHashesIdx] = std::move(vTxHashes.back()); | ||||
vTxHashes[it->vTxHashesIdx].second->vTxHashesIdx = it->vTxHashesIdx; | vTxHashes[it->vTxHashesIdx].second->vTxHashesIdx = it->vTxHashesIdx; | ||||
vTxHashes.pop_back(); | vTxHashes.pop_back(); | ||||
▲ Show 20 Lines • Show All 962 Lines • Show Last 20 Lines |