Skip to content

Commit

Permalink
dynamically adjust network difficulty when miners suddenly left
Browse files Browse the repository at this point in the history
  • Loading branch information
bihonglu committed Nov 22, 2018
1 parent 4115255 commit 6ce42e4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main.cpp
Expand Up @@ -1139,10 +1139,8 @@ unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBl
// Only change once per interval
if ((pindexLast->nHeight+1) % nInterval != 0)
{
// Special difficulty rule for testnet:
if (fTestNet)
{
// If the new block's timestamp is more than 2* 10 minutes
// dynamically adjust network difficulty when miners suddenly left
// If the new block's timestamp is more than 2 * 1 minutes
// then allow mining of a min-difficulty block.
if (pblock->nTime > pindexLast->nTime + nTargetSpacing*2)
return nProofOfWorkLimit;
Expand All @@ -1154,7 +1152,7 @@ unsigned int static GetNextWorkRequired(const CBlockIndex* pindexLast, const CBl
pindex = pindex->pprev;
return pindex->nBits;
}
}


return pindexLast->nBits;
}
Expand Down

0 comments on commit 6ce42e4

Please sign in to comment.