Skip to content

Commit c834f56

Browse files
committed
Merge pull request #6853
7801f43 Added fPowNoRetargeting field to Consensus::Params that disables nBits recalculation. (Eric Lombrozo)
2 parents 488f851 + 7801f43 commit c834f56

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/chainparams.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class CMainParams : public CChainParams {
7676
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
7777
consensus.nPowTargetSpacing = 10 * 60;
7878
consensus.fPowAllowMinDifficultyBlocks = false;
79+
consensus.fPowNoRetargeting = false;
7980
/**
8081
* The message start string is designed to be unlikely to occur in normal data.
8182
* The characters are rarely used upper ASCII, not valid as UTF-8, and produce
@@ -155,6 +156,7 @@ class CTestNetParams : public CChainParams {
155156
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
156157
consensus.nPowTargetSpacing = 10 * 60;
157158
consensus.fPowAllowMinDifficultyBlocks = true;
159+
consensus.fPowNoRetargeting = false;
158160
pchMessageStart[0] = 0x0b;
159161
pchMessageStart[1] = 0x11;
160162
pchMessageStart[2] = 0x09;
@@ -217,6 +219,7 @@ class CRegTestParams : public CChainParams {
217219
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
218220
consensus.nPowTargetSpacing = 10 * 60;
219221
consensus.fPowAllowMinDifficultyBlocks = true;
222+
consensus.fPowNoRetargeting = true;
220223

221224
pchMessageStart[0] = 0xfa;
222225
pchMessageStart[1] = 0xbf;

src/consensus/params.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct Params {
2222
/** Proof of work parameters */
2323
uint256 powLimit;
2424
bool fPowAllowMinDifficultyBlocks;
25+
bool fPowNoRetargeting;
2526
int64_t nPowTargetSpacing;
2627
int64_t nPowTargetTimespan;
2728
int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; }

src/pow.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
5252

5353
unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params)
5454
{
55+
if (params.fPowNoRetargeting)
56+
return pindexLast->nBits;
57+
5558
// Limit adjustment step
5659
int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime;
5760
LogPrintf(" nActualTimespan = %d before bounds\n", nActualTimespan);

0 commit comments

Comments
 (0)