Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set share diff target based on address hash rate #174

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
8 changes: 4 additions & 4 deletions p2pool/work.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,14 @@ def get_work(self, pubkey_hash, desired_share_target, desired_pseudoshare_target
else:
share_type = previous_share_type

local_addr_rates = self.get_local_addr_rates()

if desired_share_target is None:
desired_share_target = 2**256-1
local_hash_rate = self._estimate_local_hash_rate()
if local_hash_rate is not None:
local_hash_rate = local_addr_rates.get(pubkey_hash, 0)
if local_hash_rate > 0.0:
desired_share_target = min(desired_share_target,
bitcoin_data.average_attempts_to_target(local_hash_rate * self.node.net.SHARE_PERIOD / 0.0167)) # limit to 1.67% of pool shares by modulating share difficulty

local_addr_rates = self.get_local_addr_rates()
lookbehind = 3600//self.node.net.SHARE_PERIOD
block_subsidy = self.node.bitcoind_work.value['subsidy']
if previous_share is not None and self.node.tracker.get_height(previous_share.hash) > lookbehind:
Expand Down