From 16ff6e883a0f7f1f8d78c69e8d88fc96e3b87fcc Mon Sep 17 00:00:00 2001 From: Tim van Werkhoven Date: Tue, 20 Aug 2013 10:43:30 +0200 Subject: [PATCH] Use 'inf' as large value instead of 1e20 'inf' is always bigger than any number, 1e20 is not. --- src/proofofwork.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/proofofwork.py b/src/proofofwork.py index f2c32c06..6e2b7bc3 100644 --- a/src/proofofwork.py +++ b/src/proofofwork.py @@ -24,7 +24,7 @@ def _set_idle(): def _pool_worker(nonce, initialHash, target, pool_size): _set_idle() - trialValue = 99999999999999999999 + trialValue = float('inf') while trialValue > target: nonce += pool_size trialValue, = unpack('>Q',hashlib.sha512(hashlib.sha512(pack('>Q',nonce) + initialHash).digest()).digest()[0:8]) @@ -32,7 +32,7 @@ def _pool_worker(nonce, initialHash, target, pool_size): def _doSafePoW(target, initialHash): nonce = 0 - trialValue = 99999999999999999999 + trialValue = float('inf') while trialValue > target: nonce += 1 trialValue, = unpack('>Q',hashlib.sha512(hashlib.sha512(pack('>Q',nonce) + initialHash).digest()).digest()[0:8])