Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | bool CTxMemPool::CalculateMemPoolAncestors( | ||||
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. | ||||
for (const CTxIn &in : tx.vin) { | for (const CTxIn &in : tx.vin) { | ||||
Optional<txiter> piter = GetIter(in.prevout.GetTxId()); | std::optional<txiter> piter = GetIter(in.prevout.GetTxId()); | ||||
if (!piter) { | if (!piter) { | ||||
continue; | continue; | ||||
} | } | ||||
parentHashes.insert(*piter); | parentHashes.insert(*piter); | ||||
if (parentHashes.size() + 1 > limitAncestorCount) { | if (parentHashes.size() + 1 > limitAncestorCount) { | ||||
errString = | errString = | ||||
strprintf("too many unconfirmed parents [limit: %u]", | strprintf("too many unconfirmed parents [limit: %u]", | ||||
limitAncestorCount); | limitAncestorCount); | ||||
▲ Show 20 Lines • Show All 790 Lines • ▼ Show 20 Lines | void CTxMemPool::ClearPrioritisation(const TxId &txid) { | ||||
mapDeltas.erase(txid); | mapDeltas.erase(txid); | ||||
} | } | ||||
const CTransaction *CTxMemPool::GetConflictTx(const COutPoint &prevout) const { | const CTransaction *CTxMemPool::GetConflictTx(const COutPoint &prevout) const { | ||||
const auto it = mapNextTx.find(prevout); | const auto it = mapNextTx.find(prevout); | ||||
return it == mapNextTx.end() ? nullptr : it->second; | return it == mapNextTx.end() ? nullptr : it->second; | ||||
} | } | ||||
Optional<CTxMemPool::txiter> CTxMemPool::GetIter(const TxId &txid) const { | std::optional<CTxMemPool::txiter> CTxMemPool::GetIter(const TxId &txid) const { | ||||
auto it = mapTx.find(txid); | auto it = mapTx.find(txid); | ||||
if (it != mapTx.end()) { | if (it != mapTx.end()) { | ||||
return it; | return it; | ||||
} | } | ||||
return Optional<txiter>{}; | return std::optional<txiter>{}; | ||||
} | } | ||||
CTxMemPool::setEntries | CTxMemPool::setEntries | ||||
CTxMemPool::GetIterSet(const std::set<TxId> &txids) const { | CTxMemPool::GetIterSet(const std::set<TxId> &txids) const { | ||||
CTxMemPool::setEntries ret; | CTxMemPool::setEntries ret; | ||||
for (const auto &txid : txids) { | for (const auto &txid : txids) { | ||||
const auto mi = GetIter(txid); | const auto mi = GetIter(txid); | ||||
if (mi) { | if (mi) { | ||||
▲ Show 20 Lines • Show All 410 Lines • Show Last 20 Lines |