Skip to content

Commit

Permalink
Don't call removeForReorg if DisconnectTip fails
Browse files Browse the repository at this point in the history
  • Loading branch information
sdaftuar committed Nov 30, 2015
1 parent 7e49f5f commit b7fa4aa
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2521,11 +2521,8 @@ static bool ActivateBestChainStep(CValidationState& state, const CChainParams& c
// Disconnect active blocks which are no longer in the best chain.
bool fBlocksDisconnected = false;
while (chainActive.Tip() && chainActive.Tip() != pindexFork) {
if (!DisconnectTip(state, chainparams.GetConsensus())) {
// Probably an AbortNode() error, but try to keep mempool consistent anyway
mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1);
if (!DisconnectTip(state, chainparams.GetConsensus()))
return false;
}
fBlocksDisconnected = true;
}

Expand Down Expand Up @@ -2559,9 +2556,6 @@ static bool ActivateBestChainStep(CValidationState& state, const CChainParams& c
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 {
Expand Down

0 comments on commit b7fa4aa

Please sign in to comment.