Erase orphans per-transaction instead of per-block

pull/308/head
Matt Corallo 8 years ago
parent ec4525ccc1
commit 97e28029c9

@ -3088,8 +3088,8 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
// Remove orphan transactions with cs_main
{
LOCK(cs_main);
std::vector<uint256> vOrphanErase;
for(unsigned int i = 0; i < txChanged.size(); i++) {
std::vector<uint256> vOrphanErase;
const CTransaction& tx = std::get<0>(txChanged[i]);
// Which orphan pool entries must we evict?
for (size_t j = 0; j < tx.vin.size(); j++) {
@ -3101,7 +3101,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
vOrphanErase.push_back(orphanHash);
}
}
}
// Erase orphan transactions include or precluded by this block
if (vOrphanErase.size()) {
int nErased = 0;
@ -3111,6 +3111,7 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
LogPrint("mempool", "Erased %d orphan tx included or conflicted by block\n", nErased);
}
}
}
// Notifications/callbacks that can run without cs_main

Loading…
Cancel
Save