Skip to content

Commit

Permalink
Adjust diff for slow testnet/devnet blocks a bit smoother (dashpay#2161)
Browse files Browse the repository at this point in the history
* Adjust diff for slow testnet/devnet blocks a bit smoother

* bump to 000000000000000000000000000000000000000000000000003ff00000000000

* bump slow blocks to 10 minutes
  • Loading branch information
UdjinM6 authored Jul 7, 2018
1 parent c4698d5 commit 050cabd
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/pow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,25 @@ unsigned int static DarkGravityWave(const CBlockIndex* pindexLast, const CBlockH
// Special difficulty rule for testnet/devnet:
// 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 bnPowLimit.GetCompact();

// start using smoother adjustment on testnet when total work hits
// 000000000000000000000000000000000000000000000000003ff00000000000
if (pindexLast->nChainWork >= UintToArith256(uint256S("0x000000000000000000000000000000000000000000000000003ff00000000000"))
// and immediately on devnet
|| !params.hashDevnetGenesisBlock.IsNull()) {
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*4) {
arith_uint256 bnNew = arith_uint256().SetCompact(pindexLast->nBits) * 10;
if (bnNew > bnPowLimit) {
bnNew = bnPowLimit;
}
return bnNew.GetCompact();
}
} else {
// old stuff
if (pblock->GetBlockTime() > pindexLast->GetBlockTime() + params.nPowTargetSpacing*2) {
return bnPowLimit.GetCompact();
}
}
}

const CBlockIndex *pindex = pindexLast;
Expand Down

0 comments on commit 050cabd

Please sign in to comment.