HarukaMa / aleo-pool-server

GNU Affero General Public License v3.0
77 stars 79 forks source link

fix add_share #1

Closed liuzsen closed 2 years ago

liuzsen commented 2 years ago

Function PPLNS::add_share will set PPLNS.current_n to 0 when the new share's value is greater than PPLNS.n . It will cause inconsistencies between the data on pool and prover in rare cases

HarukaMa commented 2 years ago

It makes no sense if the value of one share would exceed the round N limit. Under current parameters, every share under that difficulty could mean 5 unconfirmed blocks worth of proofs, and the miner should really just switch to solo mining.

Note that the share value is defined by the target difficulty, not the share difficulty.

Also, discarding that share could mean that the share was a new block but the payout system is not recording it. I don't think that's what we should do. I was reading the code wrong so that sentence is not correct as well. However the current_n could really be in an inconsistent state if you just replace the queue with such a share without correctly updating the current_n value.