X-Git-Url: https://git.novaco.in/?p=stratum-mining.git;a=blobdiff_plain;f=lib%2Fextranonce_counter.py;fp=lib%2Fextranonce_counter.py;h=266f9137b5222c5d4c81ce7dacda104d776613be;hp=19254f4c7dcfdbb00fababea010cc8b384ff4b19;hb=23ebc8506325ec4b8a60ce3c49cab96ae87c006b;hpb=8a7474eb0eefdbc68e9b57371a68c25f33427f0d diff --git a/lib/extranonce_counter.py b/lib/extranonce_counter.py index 19254f4..266f913 100644 --- a/lib/extranonce_counter.py +++ b/lib/extranonce_counter.py @@ -4,22 +4,22 @@ class ExtranonceCounter(object): '''Implementation of a counter producing unique extranonce across all pool instances. This is just dumb "quick&dirty" solution, - but it can be changed at any time without breaking anything.''' + but it can be changed at any time without breaking anything.''' def __init__(self, instance_id): if instance_id < 0 or instance_id > 31: raise Exception("Current ExtranonceCounter implementation needs an instance_id in <0, 31>.") - + # Last 5 most-significant bits represents instance_id # The rest is just an iterator of jobs. self.counter = instance_id << 27 self.size = struct.calcsize('>L') - + def get_size(self): '''Return expected size of generated extranonce in bytes''' return self.size - + def get_new_bin(self): self.counter += 1 return struct.pack('>L', self.counter) - \ No newline at end of file +