Revert "Remove testnet-only difficulty rules"
This reverts commit 333ea3c426.
This commit is contained in:
17
src/pow.cpp
17
src/pow.cpp
@@ -24,6 +24,23 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
||||
if (pindexLast == NULL)
|
||||
return nProofOfWorkLimit;
|
||||
|
||||
const CBlockIndex* pindexBits = pindexLast;
|
||||
{
|
||||
if (params.fPowAllowMinDifficultyBlocks)
|
||||
{
|
||||
// Special difficulty rule for testnet:
|
||||
// If the new block's timestamp is more than 2* 2.5 minutes
|
||||
// then allow mining of a min-difficulty block.
|
||||
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2)
|
||||
return nProofOfWorkLimit;
|
||||
else {
|
||||
// Get the last non-min-difficulty (or at worst the genesis difficulty)
|
||||
while (pindexBits->pprev && pindexBits->nBits == nProofOfWorkLimit)
|
||||
pindexBits = pindexBits->pprev;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find the first block in the averaging interval
|
||||
const CBlockIndex* pindexFirst = pindexLast;
|
||||
arith_uint256 bnTot {0};
|
||||
|
||||
Reference in New Issue
Block a user