Dear forrestv and p2pool node hosters,
I've made a patch which provides adaptive share and pseudoshare difficulty to the miners. I believe it might be useful to help miners with little hashrate and reduce load by enforcing high difficulty for fast miners.
Difficulty is controled by the new '-d' command line option which can have 3 values: A - adaptive, F - force adaptive, and D (or any other) - default. Default behaves just in the same way as the original version. Adaptive provides adaptive difficulty if the miner hasn't specified desired difficulty. Force adaptive provides adaptive difficulty in any case (user's desired values are ignored).
Difficulty is calculated for each username based on its hashrate according to these target rates:
- 20 shares per min(estimated time to block, chain length * share period)
- 20 pseudoshares per 10 minutes
(per user)
Source:
https://github.com/baloo-kiev/p2pool-adaptiveTest node: 78.27.191.182:8349
It's about 30 lines of code (commented where necessary).
Diff:
https://github.com/baloo-kiev/p2pool-adaptive/commit/10e59b9564740c6b039380b5b86fdf8071543f48Also, I've just found out that share difficulty has upper limit of 10 times current minimal difficulty. It is set by line 123 in p2pool/data.py
bits = bitcoin_data.FloatingInteger.from_target_upper_bound(math.clip(desired_target, (pre_target3//10, pre_target3)))
So I'd like to know what's the reason for this limitation and whether it can be changed to generate shares with even more difficulty.