stratum-mining-litecoin
stratum-mining-litecoin copied to clipboard
Fix vardiff for alt coins with pool diff < 1
After speaking with @obigal, I am now aware of an issue with the vardiff algorithm where it does not work for coins that have a difficulty below 1. I have proposed two solutions.
- Multiply the difficulties by a multiplier (probably 64k) before doing the difference calculations and then divide it out at the end. This will take a bit of arithmetic work to fine tune, but the algorithm can stay the same (or similar).
- Define a setting on how much to increment/ decrement (VDIFF_DELTA) when changing the difficulty. The algorithm would be simple like below.
If average time > variance + time target current diff = current diff + VDIFF_DELTA current diff = min(pool diff, current diff, VDIFF_MAX_DIFF) else if average time < time target - variance current diff = current diff - VDIFF_DELTA current diff = max(VDIFF_MIN_DIFF, current diff) else return
I see a few benefits of a solution like this.
- Limits the number of difficulties, which can make the vardiff payout algorithm easier.
- Should work for integers and floating difficulties.
There are also some disadvantages with this solution.
- Limits the difficulty variance, thus limiting the optimization per client.
- Simple algorithm may overlook some other complications.
If anyone has any suggestions, I would like to hear them.
Still broken, but floating difficulties now work.