Skip human help if longer chain is invalid due to notarization

This commit is contained in:
jl777
2018-09-17 05:58:07 -11:00
parent 416c90c291
commit c5164b3c7b

View File

@@ -3626,7 +3626,17 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
// our genesis block. In practice this (probably) won't happen because of checks elsewhere.
auto reorgLength = pindexOldTip ? pindexOldTip->nHeight - (pindexFork ? pindexFork->nHeight : -1) : 0;
static_assert(MAX_REORG_LENGTH > 0, "We must be able to reorg some distance");
if (reorgLength > MAX_REORG_LENGTH) {
if (reorgLength > MAX_REORG_LENGTH)
{
int32_t notarizedht,prevMoMheight; uint256 notarizedhash,txid;
notarizedht = komodo_notarized_height(&prevMoMheight,&notarizedhash,&txid);
if ( pindexFork->nHeight < notarizedht )
{
fprintf(stderr,"pindexFork->nHeight.%d is < notarizedht %d, so ignore it\n",(int32_t)pindexFork->nHeight,notarizedht);
pindexFork = pindexOldTip;
}
else
{
auto msg = strprintf(_(
"A block chain reorganization has been detected that would roll back %d blocks! "
"This is larger than the maximum of %d blocks, and so the node is shutting down for your safety."
@@ -3644,6 +3654,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
StartShutdown();
return false;
}
}
// Disconnect active blocks which are no longer in the best chain.
bool fBlocksDisconnected = false;