fix fPowAllowMinDifficultyBlocks #146

Merged
kaykurokawa merged 1 commit from fix_testnet_pow into master 2018-05-25 18:02:37 +02:00

View file

@ -18,13 +18,14 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
if (pindexLast == NULL)
return nProofOfWorkLimit;
if (params.fPowAllowMinDifficultyBlocks)
if (params.fPowAllowMinDifficultyBlocks && pindexLast->nHeight >= 277299)
shyba commented 2018-05-25 01:27:47 +02:00 (Migrated from github.com)
Review

IMHO without the height check it made sense to simply check for fPowAllowMinDifficultyBlocks, but now that there is a hardcoded height I think it would make sense to explicitly check testnet instead of fPowAllowMinDifficultyBlocks since that's the real case of the condition right?

IMHO without the height check it made sense to simply check for `fPowAllowMinDifficultyBlocks`, but now that there is a hardcoded height I think it would make sense to explicitly check testnet instead of fPowAllowMinDifficultyBlocks since that's the real case of the condition right?
{
// Special difficulty rule for testnet:
// If the new block's timestamp is twice the target block time
// then allow mining of a min-difficulty block.
// This is to prevent the testnet from gettig stuck when a large amount
// of hashrate drops off the network.
// This rule was not implemented properly until testnet block 277299.
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2){
return nProofOfWorkLimit;
}