|
|
@ -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--; |
|
|
|