diff options
| author | Patrick Lodder <[email protected]> | 2014-08-04 14:14:36 +0200 |
|---|---|---|
| committer | Patrick Lodder <[email protected]> | 2014-08-04 14:14:36 +0200 |
| commit | 766c9a0651c16cb1f8a4f9a8e503abb364d007a1 (patch) | |
| tree | 587da753c2c35c48258779bc807c37e869037387 /src/main.cpp | |
| parent | Merge pull request #584 from patricklodder/1.8-dev-auxpow (diff) | |
| download | discoin-766c9a0651c16cb1f8a4f9a8e503abb364d007a1.tar.xz discoin-766c9a0651c16cb1f8a4f9a8e503abb364d007a1.zip | |
Break testnet difficulty reset out of never matching condition.
Testnet resets difficulty if after 2 minutes no block has been
found. However, this feature was implemented with the condition
to only trigger on blocks where no retargeting is done. Since
the introduction of DigiShield, we retarget at every block,
making this condition never to be matched. This commit removes
that condition.
WARNING: THIS COMMIT HARDFORKS THE DOGECOIN TESTNET!
The main network is not affected by this change.
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/main.cpp b/src/main.cpp index f30a3b657..dff2ad85d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1300,24 +1300,24 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead if (pindexLast == NULL) return nProofOfWorkLimit; + if (TestNet() && pblock->nTime > pindexLast->nTime + nTargetSpacing*2) + { + // Special difficulty rule for testnet: + // If the new block's timestamp is more than 2* nTargetSpacing minutes + // then allow mining of a min-difficulty block. + return nProofOfWorkLimit; + } + // Only change once per interval if ((pindexLast->nHeight+1) % retargetInterval != 0) { if (TestNet()) { - // Special difficulty rule for testnet: - // If the new block's timestamp is more than 2* nTargetSpacing minutes - // then allow mining of a min-difficulty block. - if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2) - return nProofOfWorkLimit; - else - { - // Return the last non-special-min-difficulty-rules-block - const CBlockIndex* pindex = pindexLast; - while (pindex->pprev && pindex->nHeight % retargetInterval != 0 && pindex->nBits == nProofOfWorkLimit) - pindex = pindex->pprev; - return pindex->nBits; - } + // Return the last non-special-min-difficulty-rules-block + const CBlockIndex* pindex = pindexLast; + while (pindex->pprev && pindex->nHeight % retargetInterval != 0 && pindex->nBits == nProofOfWorkLimit) + pindex = pindex->pprev; + return pindex->nBits; } return pindexLast->nBits; } |