choose chain with maximum work instead of height when ranking chain tails
authorForrest Voight <forrest.voight@gmail.com>
Wed, 7 Mar 2012 05:22:58 +0000 (00:22 -0500)
committerForrest Voight <forrest.voight@gmail.com>
Wed, 7 Mar 2012 05:22:58 +0000 (00:22 -0500)
p2pool/data.py

index f323889..76e7c53 100644 (file)
@@ -352,7 +352,7 @@ class OkayTracker(forest.Tracker):
                 ))
         
         # decide best tree
-        decorated_tails = sorted((self.score(max(self.verified.tails[tail_hash], key=self.verified.get_height), block_rel_height_func), tail_hash) for tail_hash in self.verified.tails) # XXX using get_height here is quite possibly incorrect and vulnerable
+        decorated_tails = sorted((self.score(max(self.verified.tails[tail_hash], key=self.verified.get_work), block_rel_height_func), tail_hash) for tail_hash in self.verified.tails)
         if p2pool.DEBUG:
             print len(decorated_tails), 'tails:'
             for score, tail_hash in decorated_tails: