diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 78b2b84cb..cfa76e2c3 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -104,6 +104,7 @@ public: consensus.nPreBlossomPowTargetSpacing = Consensus::PRE_BLOSSOM_POW_TARGET_SPACING; consensus.nPostBlossomPowTargetSpacing = Consensus::POST_BLOSSOM_POW_TARGET_SPACING; consensus.nPowAllowMinDifficultyBlocksAfterHeight = boost::none; + consensus.fPowNoRetargeting = false; consensus.vUpgrades[Consensus::BASE_SPROUT].nProtocolVersion = 170002; consensus.vUpgrades[Consensus::BASE_SPROUT].nActivationHeight = Consensus::NetworkUpgrade::ALWAYS_ACTIVE; @@ -381,6 +382,7 @@ public: consensus.nPreBlossomPowTargetSpacing = Consensus::PRE_BLOSSOM_POW_TARGET_SPACING; consensus.nPostBlossomPowTargetSpacing = Consensus::POST_BLOSSOM_POW_TARGET_SPACING; consensus.nPowAllowMinDifficultyBlocksAfterHeight = 299187; + consensus.fPowNoRetargeting = false; consensus.vUpgrades[Consensus::BASE_SPROUT].nProtocolVersion = 170002; consensus.vUpgrades[Consensus::BASE_SPROUT].nActivationHeight = Consensus::NetworkUpgrade::ALWAYS_ACTIVE; @@ -624,6 +626,7 @@ public: consensus.nPreBlossomPowTargetSpacing = Consensus::PRE_BLOSSOM_POW_TARGET_SPACING; consensus.nPostBlossomPowTargetSpacing = Consensus::POST_BLOSSOM_POW_TARGET_SPACING; consensus.nPowAllowMinDifficultyBlocksAfterHeight = 0; + consensus.fPowNoRetargeting = true; consensus.vUpgrades[Consensus::BASE_SPROUT].nProtocolVersion = 170002; consensus.vUpgrades[Consensus::BASE_SPROUT].nActivationHeight = Consensus::NetworkUpgrade::ALWAYS_ACTIVE; diff --git a/src/consensus/params.h b/src/consensus/params.h index ce9fa637e..2cf22f576 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -262,6 +262,7 @@ struct Params { unsigned int nEquihashK = 0; uint256 powLimit; boost::optional nPowAllowMinDifficultyBlocksAfterHeight; + bool fPowNoRetargeting; int64_t nPowAveragingWindow; int64_t nPowMaxAdjustDown; int64_t nPowMaxAdjustUp; diff --git a/src/pow.cpp b/src/pow.cpp index fe9658570..8cb9826c5 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -23,6 +23,10 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead if (pindexLast == NULL) return nProofOfWorkLimit; + // Regtest + if (params.fPowNoRetargeting) + return pindexLast->nBits; + { // Comparing to pindexLast->nHeight with >= because this function // returns the work required for the block after pindexLast.