diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-10-20 12:07:06 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-10-20 12:07:44 +0200 |
commit | c834f568693bfae2ce32a2532ac846a868bbee50 (patch) | |
tree | a32ec35716248b674890437fe7abb806e15f0bae | |
parent | 488f8517a15403d48c91dda01f740c82aa64ca63 (diff) | |
parent | 7801f4387d96c19de6dedc518e45d3037d9c53fa (diff) | |
download | bitcoin-c834f568693bfae2ce32a2532ac846a868bbee50.tar.xz |
Merge pull request #6853
7801f43 Added fPowNoRetargeting field to Consensus::Params that disables nBits recalculation. (Eric Lombrozo)
-rw-r--r-- | src/chainparams.cpp | 3 | ||||
-rw-r--r-- | src/consensus/params.h | 1 | ||||
-rw-r--r-- | src/pow.cpp | 3 |
3 files changed, 7 insertions, 0 deletions
diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 430b75683b..52d818059e 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -76,6 +76,7 @@ public: consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks consensus.nPowTargetSpacing = 10 * 60; consensus.fPowAllowMinDifficultyBlocks = false; + consensus.fPowNoRetargeting = false; /** * The message start string is designed to be unlikely to occur in normal data. * The characters are rarely used upper ASCII, not valid as UTF-8, and produce @@ -155,6 +156,7 @@ public: consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks consensus.nPowTargetSpacing = 10 * 60; consensus.fPowAllowMinDifficultyBlocks = true; + consensus.fPowNoRetargeting = false; pchMessageStart[0] = 0x0b; pchMessageStart[1] = 0x11; pchMessageStart[2] = 0x09; @@ -217,6 +219,7 @@ public: consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks consensus.nPowTargetSpacing = 10 * 60; consensus.fPowAllowMinDifficultyBlocks = true; + consensus.fPowNoRetargeting = true; pchMessageStart[0] = 0xfa; pchMessageStart[1] = 0xbf; diff --git a/src/consensus/params.h b/src/consensus/params.h index c480a1cce1..efbbbed352 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -22,6 +22,7 @@ struct Params { /** Proof of work parameters */ uint256 powLimit; bool fPowAllowMinDifficultyBlocks; + bool fPowNoRetargeting; int64_t nPowTargetSpacing; int64_t nPowTargetTimespan; int64_t DifficultyAdjustmentInterval() const { return nPowTargetTimespan / nPowTargetSpacing; } diff --git a/src/pow.cpp b/src/pow.cpp index bb53ad204b..5ace3fbc9b 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -52,6 +52,9 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead unsigned int CalculateNextWorkRequired(const CBlockIndex* pindexLast, int64_t nFirstBlockTime, const Consensus::Params& params) { + if (params.fPowNoRetargeting) + return pindexLast->nBits; + // Limit adjustment step int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime; LogPrintf(" nActualTimespan = %d before bounds\n", nActualTimespan); |