This commit is contained in:
jl777
2019-07-31 19:32:41 -11:00
parent 199d8db019
commit 4f64b197d2

View File

@@ -5288,11 +5288,22 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
} }
// Check timestamp against prev // Check timestamp against prev
if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast() + 2*ASSETCHAINS_ADAPTIVEPOW*ASSETCHAINS_BLOCKTIME ) if ( ASSETCHAINS_ADAPTIVEPOW == 0 || nHeight < 1000 )
{
if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast() )
{ {
return state.Invalid(error("%s: block's timestamp is too early", __func__), return state.Invalid(error("%s: block's timestamp is too early", __func__),
REJECT_INVALID, "time-too-old"); REJECT_INVALID, "time-too-old");
} }
}
else
{
if ( block.GetBlockTime() <= pindexPrev->GetMedianTimePast() + 2*ASSETCHAINS_ADAPTIVEPOW*ASSETCHAINS_BLOCKTIME )
{
return state.Invalid(error("%s: block's timestamp is too early2", __func__),
REJECT_INVALID, "time-too-old");
}
}
// Check that timestamp is not too far in the future // Check that timestamp is not too far in the future
if (block.GetBlockTime() > GetAdjustedTime() + consensusParams.nMaxFutureBlockTime) if (block.GetBlockTime() > GetAdjustedTime() + consensusParams.nMaxFutureBlockTime)