aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorMatt Corallo <git@bluematt.me>2016-11-03 14:53:12 -0400
committerMatt Corallo <git@bluematt.me>2016-11-17 17:10:00 -0800
commit97e28029c94bc187721242a8c59468cebd73441b (patch)
treef0b67bdc60fd9f5d2c0cf73649acd40320ba7768 /src/main.cpp
parentec4525ccc1c1b66bc99f064348a9842e163c1324 (diff)
Erase orphans per-transaction instead of per-block
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp
index d587b39e64..a5b0081363 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -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,14 +3101,15 @@ 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;
- BOOST_FOREACH(uint256 &orphanHash, vOrphanErase) {
- nErased += EraseOrphanTx(orphanHash);
+
+ // Erase orphan transactions include or precluded by this block
+ if (vOrphanErase.size()) {
+ int nErased = 0;
+ BOOST_FOREACH(uint256 &orphanHash, vOrphanErase) {
+ nErased += EraseOrphanTx(orphanHash);
+ }
+ LogPrint("mempool", "Erased %d orphan tx included or conflicted by block\n", nErased);
}
- LogPrint("mempool", "Erased %d orphan tx included or conflicted by block\n", nErased);
}
}