Changeset View
Changeset View
Standalone View
Standalone View
src/txorphanage.cpp
Show First 20 Lines • Show All 106 Lines • ▼ Show 20 Lines | unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans) { | ||||
while (mapOrphanTransactions.size() > nMaxOrphans) { | while (mapOrphanTransactions.size() > nMaxOrphans) { | ||||
// Evict a random orphan: | // Evict a random orphan: | ||||
size_t randompos = rng.randrange(g_orphan_list.size()); | size_t randompos = rng.randrange(g_orphan_list.size()); | ||||
EraseOrphanTx(g_orphan_list[randompos]->first); | EraseOrphanTx(g_orphan_list[randompos]->first); | ||||
++nEvicted; | ++nEvicted; | ||||
} | } | ||||
return nEvicted; | return nEvicted; | ||||
} | } | ||||
void AddChildrenToWorkSet(const CTransaction &tx, | |||||
std::set<TxId> &orphan_work_set) { | |||||
AssertLockHeld(g_cs_orphans); | |||||
for (size_t i = 0; i < tx.vout.size(); i++) { | |||||
const auto it_by_prev = | |||||
mapOrphanTransactionsByPrev.find(COutPoint(tx.GetId(), i)); | |||||
if (it_by_prev != mapOrphanTransactionsByPrev.end()) { | |||||
for (const auto &elem : it_by_prev->second) { | |||||
orphan_work_set.insert(elem->first); | |||||
} | |||||
} | |||||
} | |||||
} |