prevent division by 0 when block headers are not fully downloaded
authorForrest Voight <forrest@forre.st>
Sun, 5 Feb 2012 11:19:57 +0000 (06:19 -0500)
committerForrest Voight <forrest@forre.st>
Sun, 5 Feb 2012 11:19:57 +0000 (06:19 -0500)
p2pool/data.py

index 81e77c3..d402fd8 100644 (file)
@@ -409,7 +409,7 @@ class OkayTracker(forest.Tracker):
                 best = best_share.previous_hash
             
             timestamp_cutoff = min(int(time.time()), best_share.timestamp) - 3600
-            target_cutoff = 2**256//(self.net.SHARE_PERIOD*best_tail_score[1]) * 2 if best_tail_score[1] is not None else 2**256-1
+            target_cutoff = 2**256//(self.net.SHARE_PERIOD*best_tail_score[1] + 1) * 2 if best_tail_score[1] is not None else 2**256-1
         else:
             timestamp_cutoff = int(time.time()) - 24*60*60
             target_cutoff = 2**256-1