Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 403 Lines • ▼ Show 20 Lines | unsigned int CTxMemPool::GetTransactionsUpdated() const { | ||||
return nTransactionsUpdated; | return nTransactionsUpdated; | ||||
} | } | ||||
void CTxMemPool::AddTransactionsUpdated(unsigned int n) { | void CTxMemPool::AddTransactionsUpdated(unsigned int n) { | ||||
LOCK(cs); | LOCK(cs); | ||||
nTransactionsUpdated += n; | nTransactionsUpdated += n; | ||||
} | } | ||||
bool CTxMemPool::addUnchecked(const uint256 &hash, const CTxMemPoolEntry &entry, | void CTxMemPool::addUnchecked(const uint256 &hash, const CTxMemPoolEntry &entry, | ||||
setEntries &setAncestors) { | setEntries &setAncestors) { | ||||
NotifyEntryAdded(entry.GetSharedTx()); | 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. | ||||
LOCK(cs); | LOCK(cs); | ||||
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())); | ||||
Show All 36 Lines | void CTxMemPool::addUnchecked(const uint256 &hash, const CTxMemPoolEntry &entry, | ||||
UpdateAncestorsOf(true, newit, setAncestors); | UpdateAncestorsOf(true, newit, setAncestors); | ||||
UpdateEntryForAncestors(newit, setAncestors); | UpdateEntryForAncestors(newit, setAncestors); | ||||
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; | ||||
return true; | |||||
} | } | ||||
void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) { | void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) { | ||||
NotifyEntryRemoved(it->GetSharedTx(), reason); | 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); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 604 Lines • ▼ Show 20 Lines | void CTxMemPool::LimitSize(size_t limit, unsigned long age) { | ||||
std::vector<COutPoint> vNoSpendsRemaining; | std::vector<COutPoint> vNoSpendsRemaining; | ||||
TrimToSize(limit, &vNoSpendsRemaining); | TrimToSize(limit, &vNoSpendsRemaining); | ||||
for (const COutPoint &removed : vNoSpendsRemaining) { | for (const COutPoint &removed : vNoSpendsRemaining) { | ||||
pcoinsTip->Uncache(removed); | pcoinsTip->Uncache(removed); | ||||
} | } | ||||
} | } | ||||
bool CTxMemPool::addUnchecked(const uint256 &hash, | void CTxMemPool::addUnchecked(const uint256 &hash, | ||||
const CTxMemPoolEntry &entry) { | const CTxMemPoolEntry &entry) { | ||||
LOCK(cs); | LOCK(cs); | ||||
setEntries setAncestors; | setEntries setAncestors; | ||||
uint64_t nNoLimit = std::numeric_limits<uint64_t>::max(); | uint64_t nNoLimit = std::numeric_limits<uint64_t>::max(); | ||||
std::string dummy; | std::string dummy; | ||||
CalculateMemPoolAncestors(entry, setAncestors, nNoLimit, nNoLimit, nNoLimit, | CalculateMemPoolAncestors(entry, setAncestors, nNoLimit, nNoLimit, nNoLimit, | ||||
nNoLimit, dummy); | nNoLimit, dummy); | ||||
return addUnchecked(hash, entry, setAncestors); | return addUnchecked(hash, entry, setAncestors); | ||||
▲ Show 20 Lines • Show All 302 Lines • Show Last 20 Lines |