Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 177 Lines • ▼ Show 20 Lines | void CTxMemPool::UpdateTransactionsFromBlock( | ||||
} | } | ||||
} | } | ||||
bool CTxMemPool::CalculateMemPoolAncestors( | bool CTxMemPool::CalculateMemPoolAncestors( | ||||
const CTxMemPoolEntry &entry, setEntries &setAncestors, | const CTxMemPoolEntry &entry, setEntries &setAncestors, | ||||
uint64_t limitAncestorCount, uint64_t limitAncestorSize, | uint64_t limitAncestorCount, uint64_t limitAncestorSize, | ||||
uint64_t limitDescendantCount, uint64_t limitDescendantSize, | uint64_t limitDescendantCount, uint64_t limitDescendantSize, | ||||
std::string &errString, bool fSearchForParents /* = true */) const { | std::string &errString, bool fSearchForParents /* = true */) const { | ||||
LOCK(cs); | |||||
setEntries parentHashes; | setEntries parentHashes; | ||||
const CTransaction &tx = entry.GetTx(); | const CTransaction &tx = entry.GetTx(); | ||||
if (fSearchForParents) { | if (fSearchForParents) { | ||||
// Get parents of this transaction that are in the mempool | // Get parents of this transaction that are in the mempool | ||||
// GetMemPoolParents() is only valid for entries in the mempool, so we | // GetMemPoolParents() is only valid for entries in the mempool, so we | ||||
// iterate mapTx to find parents. | // iterate mapTx to find parents. | ||||
▲ Show 20 Lines • Show All 214 Lines • ▼ Show 20 Lines | void CTxMemPool::AddTransactionsUpdated(unsigned int n) { | ||||
nTransactionsUpdated += n; | nTransactionsUpdated += n; | ||||
} | } | ||||
void 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); | |||||
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. | ||||
std::map<uint256, TXModifier>::const_iterator pos = mapDeltas.find(hash); | std::map<uint256, TXModifier>::const_iterator pos = mapDeltas.find(hash); | ||||
if (pos != mapDeltas.end()) { | if (pos != mapDeltas.end()) { | ||||
▲ Show 20 Lines • Show All 653 Lines • ▼ Show 20 Lines | void CTxMemPool::LimitSize(size_t limit, unsigned long age) { | ||||
TrimToSize(limit, &vNoSpendsRemaining); | TrimToSize(limit, &vNoSpendsRemaining); | ||||
for (const COutPoint &removed : vNoSpendsRemaining) { | for (const COutPoint &removed : vNoSpendsRemaining) { | ||||
pcoinsTip->Uncache(removed); | pcoinsTip->Uncache(removed); | ||||
} | } | ||||
} | } | ||||
void CTxMemPool::addUnchecked(const uint256 &hash, | void CTxMemPool::addUnchecked(const uint256 &hash, | ||||
const CTxMemPoolEntry &entry) { | const CTxMemPoolEntry &entry) { | ||||
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 300 Lines • Show Last 20 Lines |