Fixed kevacoin difficulty calculation.

This commit is contained in:
Jianping Wu 2019-01-18 12:13:09 -08:00
parent 86d85c886d
commit d814fc3128

View File

@ -64,14 +64,14 @@ double GetDifficulty(const CChain& chain, const CBlockIndex* blockindex)
int nShift = (blockindex->nBits >> 24) & 0xff; int nShift = (blockindex->nBits >> 24) & 0xff;
double dDiff = double dDiff =
(double)0x0000ffff / (double)(blockindex->nBits & 0x00ffffff); (double)0x0ffff0 / (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--;