From e8533655a72ef8dc6ad8bc350410abd974b9aed9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 21 May 2017 16:57:49 +0300 Subject: [PATCH] Protect first block --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 05968b2ee..3585cd369 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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(¬arized_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));