Browse Source

Support testnet diffs

master
Con Kolivas 10 years ago
parent
commit
7b0611119f
  1. 3
      src/libckpool.c

3
src/libckpool.c

@ -1967,7 +1967,10 @@ double diff_from_nbits(char *nbits)
pow = nbits[0]; pow = nbits[0];
powdiff = (8 * (0x1d - 3)) - (8 * (pow - 3)); powdiff = (8 * (0x1d - 3)) - (8 * (pow - 3));
diff32 = be32toh(*((uint32_t *)nbits)) & 0x00FFFFFF; diff32 = be32toh(*((uint32_t *)nbits)) & 0x00FFFFFF;
if (likely(powdiff > 0))
numerator = 0xFFFFULL << powdiff; numerator = 0xFFFFULL << powdiff;
else
numerator = 0xFFFFULL >> -powdiff;
return numerator / (double)diff32; return numerator / (double)diff32;
} }

Loading…
Cancel
Save