moopless / stratum-mining-litecoin

This fork is no longer maintained. Please use https://github.com/ahmedbodi/stratum-mining
Other
38 stars 35 forks source link

Fix vardiff for alt coins with pool diff < 1 #18

Open moopless opened 11 years ago

moopless commented 11 years ago

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.

  1. 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).
  2. 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.

There are also some disadvantages with this solution.

If anyone has any suggestions, I would like to hear them.

moopless commented 11 years ago

Still broken, but floating difficulties now work.