if last not in self._tracker.tails:
return -1e300
return height - max(self._tracker.get_height(head_hash) for head_hash in self._tracker.tails[last])
-
+
def stop(self):
self._factory.new_headers.unwatch(self._watch1)
self._factory.new_block.unwatch(self._watch2)
from p2pool import data as p2pool_data
from p2pool.bitcoin import p2p as bitcoin_p2p
from p2pool.bitcoin import data as bitcoin_data
-from p2pool.util import deferral, dicts
+from p2pool.util import deferral
class Protocol(bitcoin_p2p.BaseProtocol):
version = 2
def test_tracker(self):
t = DumbTracker(self.shares.itervalues())
-
+
assert self.shares == t.shares, (self.shares, t.shares)
assert self.reverse_shares == t.reverse_shares, (self.reverse_shares, t.reverse_shares)
assert self.heads == t.heads, (self.heads, t.heads)
class Test(unittest.TestCase):
def test_tracker(self):
t = generate_tracker_simple(1000)
-
+
assert t.heads == {999: None}
assert t.tails == {None: set([999])}
-
+
assert t.get_nth_parent_hash(900, 500) == 900 - 500
assert t.get_nth_parent_hash(901, 42) == 901 - 42