Only enable min-difficulty blocks on testnet from a particular height

The min-difficulty change is a bilateral consensus rule change, and so
must be conditionally enabled in order for the earlier section of the
chain to synchronise.

Technically this could be implemented as a network upgrade, but as this will
never be deployed to mainnet, a targeted fork will suffice.
This commit is contained in:
Jack Grigg
2018-10-04 14:05:27 +01:00
parent 1702a86455
commit b86dc98047
4 changed files with 11 additions and 7 deletions

View File

@@ -25,7 +25,8 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
return nProofOfWorkLimit;
{
if (params.fPowAllowMinDifficultyBlocks)
if (params.nPowAllowMinDifficultyBlocksFromHeight &&
pindexLast->nHeight >= params.nPowAllowMinDifficultyBlocksFromHeight.get())
{
// Special difficulty rule for testnet:
// If the new block's timestamp is more than 6 * 2.5 minutes