We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent beb8260 commit e9e8a36Copy full SHA for e9e8a36
src/tests/test_openclpow.py
@@ -1,10 +1,10 @@
1
"""
2
Tests for openclpow module
3
4
-import hashlib
+
5
import unittest
6
-from struct import pack, unpack
7
-from pybitmessage import openclpow
+from pybitmessage import openclpow, proofofwork
8
9
10
class TestOpenClPow(unittest.TestCase):
@@ -25,7 +25,5 @@ def test_openclpow(self):
25
"b93f3ffeba0ef2fd08a8dc2f87b68ae5a0dc819ab57f22ad2c4c9c8618a43b3"
26
).decode("hex")
27
nonce = openclpow.do_opencl_pow(initialHash.encode("hex"), target_)
28
- trialValue, = unpack(
29
- '>Q', hashlib.sha512(hashlib.sha512(
30
- pack('>Q', nonce) + initialHash).digest()).digest()[0:8])
31
- self.assertLess((nonce - trialValue), target_)
+ self.assertLess(
+ nonce - proofofwork.trial_value(nonce, initialHash), target_)
0 commit comments