Protect first block

This commit is contained in:
jl777
2017-05-21 16:57:49 +03:00
parent bfa5cb42bd
commit e8533655a7

View File

@@ -3329,7 +3329,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
// Don't accept any forks from the main chain prior to last checkpoint
CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints());
int32_t notarized_height;
if (pcheckpoint && nHeight < pcheckpoint->nHeight)
if (pcheckpoint && (nHeight < pcheckpoint->nHeight || nHeight == 1 && chainActive().Tip->nHeight > 1) )
return state.DoS(100, error("%s: forked chain older than last checkpoint (height %d) vs %d", __func__, nHeight,pcheckpoint->nHeight));
else if ( komodo_checkpoint(&notarized_height,nHeight,hash) < 0 )
return state.DoS(100, error("%s: forked chain %d older than last notarized (height %d) vs %d", __func__,nHeight, notarized_height));