made HeightTracker's backlog length depend on the block period of the parent currency...
authorForrest Voight <forrest@forre.st>
Sat, 18 Feb 2012 05:30:12 +0000 (00:30 -0500)
committerForrest Voight <forrest@forre.st>
Sat, 18 Feb 2012 05:30:12 +0000 (00:30 -0500)
p2pool/bitcoin/p2p.py
p2pool/main.py

index ca3f0c1..9592ef3 100644 (file)
@@ -286,7 +286,7 @@ class HeaderWrapper(object):
 class HeightTracker(object):
     '''Point this at a factory and let it take care of getting block heights'''
     
-    def __init__(self, rpc_proxy, factory, backlog_needed=1000):
+    def __init__(self, rpc_proxy, factory, backlog_needed):
         self._rpc_proxy = rpc_proxy
         self._factory = factory
         self._backlog_needed = backlog_needed
index bc0ae29..34f7f05 100644 (file)
@@ -184,7 +184,7 @@ def main(args, net, datadir_path, merged_urls, worker_endpoint):
                 best_height_cached.set(max(best_height_cached.value, this_height, best_height))
                 return this_height - best_height_cached.value
         else:
-            get_height_rel_highest = bitcoin_p2p.HeightTracker(bitcoind, factory).get_height_rel_highest
+            get_height_rel_highest = bitcoin_p2p.HeightTracker(bitcoind, factory, 5*net.SHARE_PERIOD*net.CHAIN_LENGTH/net.PARENT.BLOCK_PERIOD).get_height_rel_highest
         
         def set_real_work2():
             best, desired = tracker.think(get_height_rel_highest, pre_current_work.value['previous_block'], pre_current_work.value['bits'])