added parameters for min difficulty range

This commit is contained in:
Brannon King 2019-02-11 11:47:19 -07:00
parent 1086affae0
commit 70fe103184
3 changed files with 8 additions and 1 deletions

View file

@ -135,6 +135,7 @@ public:
consensus.nExtendedClaimExpirationTime = 2102400;
consensus.nExtendedClaimExpirationForkHeight = 400155;
consensus.fPowAllowMinDifficultyBlocks = false;
consensus.nAllowMinDiffMinHeight = consensus.nAllowMinDiffMaxHeight = -1;
consensus.fPowNoRetargeting = false;
consensus.nNormalizedNameForkHeight = 539940; // targeting 21 March 2019
consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016
@ -223,6 +224,8 @@ public:
consensus.nExtendedClaimExpirationTime = 2102400;
consensus.nExtendedClaimExpirationForkHeight = 278160;
consensus.fPowAllowMinDifficultyBlocks = true;
consensus.nAllowMinDiffMinHeight = 277299;
consensus.nAllowMinDiffMaxHeight = 1100000;
consensus.fPowNoRetargeting = false;
consensus.nNormalizedNameForkHeight = 993380; // targeting, 21 Feb 2019
consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
@ -304,6 +307,7 @@ public:
consensus.nExtendedClaimExpirationTime = 600;
consensus.nExtendedClaimExpirationForkHeight = 800;
consensus.fPowAllowMinDifficultyBlocks = false;
consensus.nAllowMinDiffMinHeight = consensus.nAllowMinDiffMaxHeight = -1;
consensus.fPowNoRetargeting = false;
consensus.nNormalizedNameForkHeight = 250; // SDK depends upon this number
consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains

View file

@ -55,6 +55,8 @@ struct Params {
/** Proof of work parameters */
uint256 powLimit;
bool fPowAllowMinDifficultyBlocks;
int nAllowMinDiffMinHeight;
int nAllowMinDiffMaxHeight;
bool fPowNoRetargeting;
int nNormalizedNameForkHeight;
int64_t nPowTargetSpacing;

View file

@ -18,7 +18,8 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
if (pindexLast == NULL)
return nProofOfWorkLimit;
if (params.fPowAllowMinDifficultyBlocks && pindexLast->nHeight >= 277299 && pindexLast->nHeight < 1100000)
if (params.fPowAllowMinDifficultyBlocks && pindexLast->nHeight >= params.nAllowMinDiffMinHeight
&& pindexLast->nHeight < params.nAllowMinDiffMaxHeight)
{
// Special difficulty rule for testnet:
// If the new block's timestamp is twice the target block time