Skip to content

Commit 97e2802

Browse files
committed
Erase orphans per-transaction instead of per-block
1 parent ec4525c commit 97e2802

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/main.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3088,8 +3088,8 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
30883088
// Remove orphan transactions with cs_main
30893089
{
30903090
LOCK(cs_main);
3091-
std::vector<uint256> vOrphanErase;
30923091
for(unsigned int i = 0; i < txChanged.size(); i++) {
3092+
std::vector<uint256> vOrphanErase;
30933093
const CTransaction& tx = std::get<0>(txChanged[i]);
30943094
// Which orphan pool entries must we evict?
30953095
for (size_t j = 0; j < tx.vin.size(); j++) {
@@ -3101,14 +3101,15 @@ bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams,
31013101
vOrphanErase.push_back(orphanHash);
31023102
}
31033103
}
3104-
}
3105-
// Erase orphan transactions include or precluded by this block
3106-
if (vOrphanErase.size()) {
3107-
int nErased = 0;
3108-
BOOST_FOREACH(uint256 &orphanHash, vOrphanErase) {
3109-
nErased += EraseOrphanTx(orphanHash);
3104+
3105+
// Erase orphan transactions include or precluded by this block
3106+
if (vOrphanErase.size()) {
3107+
int nErased = 0;
3108+
BOOST_FOREACH(uint256 &orphanHash, vOrphanErase) {
3109+
nErased += EraseOrphanTx(orphanHash);
3110+
}
3111+
LogPrint("mempool", "Erased %d orphan tx included or conflicted by block\n", nErased);
31103112
}
3111-
LogPrint("mempool", "Erased %d orphan tx included or conflicted by block\n", nErased);
31123113
}
31133114
}
31143115

0 commit comments

Comments
 (0)