diff options
| author | langerhans <[email protected]> | 2014-08-04 19:10:17 +0200 |
|---|---|---|
| committer | langerhans <[email protected]> | 2014-08-04 19:10:17 +0200 |
| commit | 553a17edaa1c58a4327ee94278a3b297b7269409 (patch) | |
| tree | 28a973b1d8400f4c5d305933c970663ab4e6d478 /src/main.cpp | |
| parent | Merge pull request #588 from patricklodder/1.8-dev-retargeting (diff) | |
| parent | Break testnet difficulty reset out of never matching condition. (diff) | |
| download | discoin-553a17edaa1c58a4327ee94278a3b297b7269409.tar.xz discoin-553a17edaa1c58a4327ee94278a3b297b7269409.zip | |
Merge pull request #589 from patricklodder/1.8-dev-testnet-retarget
Break testnet difficulty reset out of never matching condition.
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 03dfae485..6dbcca8b7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1299,24 +1299,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; } |