Reject height 1 reorganization
This commit is contained in:
@@ -4060,7 +4060,9 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
|
|||||||
// Don't accept any forks from the main chain prior to last checkpoint
|
// Don't accept any forks from the main chain prior to last checkpoint
|
||||||
CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints());
|
CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints());
|
||||||
int32_t notarized_height;
|
int32_t notarized_height;
|
||||||
if ( nHeight > 1 )
|
if ( nHeight == 1 && chainActive.Tip() != 0 && chainActive.Tip()->nHeight > 1 )
|
||||||
|
return(false)
|
||||||
|
if ( nHeight != 0 )
|
||||||
{
|
{
|
||||||
if ( pcheckpoint != 0 && nHeight < pcheckpoint->nHeight )
|
if ( pcheckpoint != 0 && nHeight < pcheckpoint->nHeight )
|
||||||
return state.DoS(1, error("%s: forked chain older than last checkpoint (height %d) vs %d", __func__, nHeight,pcheckpoint->nHeight));
|
return state.DoS(1, error("%s: forked chain older than last checkpoint (height %d) vs %d", __func__, nHeight,pcheckpoint->nHeight));
|
||||||
|
|||||||
Reference in New Issue
Block a user