Browse Source

Don't call removeForReorg if DisconnectTip fails

metaverse
Suhas Daftuar 9 years ago
committed by Jack Grigg
parent
commit
e52ba51bda
No known key found for this signature in database GPG Key ID: 665DBCD284F7DAFF
  1. 8
      src/main.cpp

8
src/main.cpp

@ -2640,11 +2640,8 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
// Disconnect active blocks which are no longer in the best chain.
bool fBlocksDisconnected = false;
while (chainActive.Tip() && chainActive.Tip() != pindexFork) {
if (!DisconnectTip(state)) {
// Probably an AbortNode() error, but try to keep mempool consistent anyway
mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1);
if (!DisconnectTip(state))
return false;
}
fBlocksDisconnected = true;
}
@ -2678,9 +2675,6 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
break;
} else {
// A system error occurred (disk space, database error, ...).
// Probably gonna shut down ASAP, but try to keep mempool consistent anyway
if (fBlocksDisconnected)
mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1);
return false;
}
} else {

Loading…
Cancel
Save