Don't call removeForReorg if DisconnectTip fails
This commit is contained in:
committed by
Jack Grigg
parent
a4b2518068
commit
e52ba51bda
@@ -2640,11 +2640,8 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
|
|||||||
// Disconnect active blocks which are no longer in the best chain.
|
// Disconnect active blocks which are no longer in the best chain.
|
||||||
bool fBlocksDisconnected = false;
|
bool fBlocksDisconnected = false;
|
||||||
while (chainActive.Tip() && chainActive.Tip() != pindexFork) {
|
while (chainActive.Tip() && chainActive.Tip() != pindexFork) {
|
||||||
if (!DisconnectTip(state)) {
|
if (!DisconnectTip(state))
|
||||||
// Probably an AbortNode() error, but try to keep mempool consistent anyway
|
|
||||||
mempool.removeForReorg(pcoinsTip, chainActive.Tip()->nHeight + 1);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
fBlocksDisconnected = true;
|
fBlocksDisconnected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2678,9 +2675,6 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
|
|||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
// A system error occurred (disk space, database error, ...).
|
// 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;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user