normalize difficulty so that 1 == minmum difficulty

This commit is contained in:
kaykurokawa 2018-05-30 14:58:13 -07:00 committed by Umpei Kay Kurokawa
parent 047abede75
commit f4be61d90a

View file

@ -48,12 +48,12 @@ double GetDifficulty(const CBlockIndex* blockindex)
double dDiff = double dDiff =
(double)0x0000ffff / (double)(blockindex->nBits & 0x00ffffff); (double)0x0000ffff / (double)(blockindex->nBits & 0x00ffffff);
while (nShift < 29) while (nShift < 31)
{ {
dDiff *= 256.0; dDiff *= 256.0;
nShift++; nShift++;
} }
while (nShift > 29) while (nShift > 31)
{ {
dDiff /= 256.0; dDiff /= 256.0;
nShift--; nShift--;