forknote / forknote-pool

Mining pool for Bytecoin/Forknote based coins such as Bytecoin and Dashcoin.
https://github.com/forknote/forknote-pool
GNU General Public License v2.0
123 stars 185 forks source link

Negative Shares/Diff percentage?!? #59

Open roshljo opened 6 years ago

roshljo commented 6 years ago

Hello, when the pool cannot find a block for some time, i.e. when the Shares/Diff percentage is obviously more than 100%, I do not get the correct value like for example 123%, but the API displays negative numbers instead! Like -93%, -37%, etc. Any idea why, anyone?

leisegang commented 6 years ago

you want it to write 137% instead of -37%.

What would be more "logical" for me as well since there has been hashed 37% more than current difficulty

leisegang commented 6 years ago

edit the pool_blocks.html and edit it to this:

else { var accurateShares = shares; } if (difficulty > accurateShares){ var percent = 100 - Math.round(accurateShares / difficulty * 100); return '<span class="luckGood">' + percent + '%</span>'; } else{ var percent = (Math.round(accurateShares / difficulty * 100)) * 1; return '<span class="luckBad">' + percent + '%</span>'; }

roshljo commented 6 years ago

Thank you very much, that was what I needed. I also removed the "100 - " in the case where the luck is positive, so that I now always see the shares/diff*100 as a % value there. It clearly represents the actual work done for the specific block.

leisegang commented 6 years ago

Please paste your updated code so other too can use it. I just did a quick and dirty update. Please share yours.

roshljo commented 6 years ago

I use the following: else { var accurateShares = shares; } if (difficulty > accurateShares){ var percent = Math.round(accurateShares / difficulty 100); return '' + percent + '%'; } else{ var percent = (Math.round(accurateShares / difficulty 100)) * 1; return '' + percent + '%'; }

This way the value shown is always shares/difficulty, no matter if it is 1% or 500%, only the colour changes from green to red when it is over 100%