I analyzed the code and did some testing to verify sharediff and the variables
used to calculate it.
The 256 bit arithmetic is done by converting the hash and target to double
using a simple polynomial:
double dhash = hash[0] + hash[1]*base + hash[2]*base**2 + hash[3]*base**3;
This will introduce some loss of precision but not a 4x error. The resulting precision
matches the precision of the
Hash is as accepted by the pool, therefore correct.
Target is calculated from the
occasional low diff rejected shares, which isn't happening.
If the target was too high there would be no errors but the miner would neglect to
submit shares that would be accepted, resulting in a lower hashrate at the pool.
That was not observed.
In addition, I did some testing by raising the difficulty by 4x and low difficulty shares
were produced. 2x higher also produced low diff shares proving the original target
was neither too low nor too high.
The formula used:
sharediff =
I can find nothing wrong with the sharediff calculation. It points back to the constant divisor
in the wiki arcticle being in error.
I'm willing ro accept it's simply a documentation error. My confidence in my code has increased
by doing a detailed analysis, however, it's still a hack without a proper explanation.
Edit: corrected references to stratum diff instead of network diff