fixed off-by-one error in local hash rate estimation
authorForrest Voight <forrest.voight@gmail.com>
Tue, 6 Mar 2012 17:50:21 +0000 (12:50 -0500)
committerForrest Voight <forrest.voight@gmail.com>
Tue, 6 Mar 2012 17:50:21 +0000 (12:50 -0500)
p2pool/main.py

index a8b6b81..1c15600 100644 (file)
@@ -520,7 +520,7 @@ def main(args, net, datadir_path, merged_urls, worker_endpoint):
                 target = net.PARENT.SANE_MAX_TARGET
                 if desired_pseudoshare_target is None:
                     if len(self.recent_shares_ts_work) == 50:
-                        hash_rate = sum(work for ts, work in self.recent_shares_ts_work)//(self.recent_shares_ts_work[-1][0] - self.recent_shares_ts_work[0][0])
+                        hash_rate = sum(work for ts, work in self.recent_shares_ts_work[1:])//(self.recent_shares_ts_work[-1][0] - self.recent_shares_ts_work[0][0])
                         target = min(target, 2**256//hash_rate)
                 else:
                     target = min(target, desired_pseudoshare_target)