From d3a3a4bb6b90ae34ec953840a7712b5941458f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjist=C3=B3f?= Date: Sun, 3 Dec 2017 13:44:04 +0100 Subject: [PATCH] added start/step support to work() to support multithreading --- proofow.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proofow.py b/proofow.py index da06fb1..cd06c07 100644 --- a/proofow.py +++ b/proofow.py @@ -18,8 +18,8 @@ class pow_base: self._base = urandom(self._bits//8) if not base else base self._target = 2 ** (self._bits - difficulty) - def work(self, max_attempts=0): - cycles = count() if max_attempts == 0 else range(max_attempts) + def work(self, max_attempts=0, start=0, step=1): + cycles = count(start, step) if max_attempts == 0 else range(start, max_attempts, step) for nonce in cycles: if self.verify(nonce): return nonce