Browse Source

Fixed kevacoin difficulty calculation.

cn
Jianping Wu 6 years ago
parent
commit
d814fc3128
  1. 6
      src/rpc/blockchain.cpp

6
src/rpc/blockchain.cpp

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

Loading…
Cancel
Save