Skip to content

Commit e9e8a36

Browse files
committed
Use proofofwork.trial_value() in tests.test_openclpow
1 parent beb8260 commit e9e8a36

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/tests/test_openclpow.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""
22
Tests for openclpow module
33
"""
4-
import hashlib
4+
55
import unittest
6-
from struct import pack, unpack
7-
from pybitmessage import openclpow
6+
7+
from pybitmessage import openclpow, proofofwork
88

99

1010
class TestOpenClPow(unittest.TestCase):
@@ -25,7 +25,5 @@ def test_openclpow(self):
2525
"b93f3ffeba0ef2fd08a8dc2f87b68ae5a0dc819ab57f22ad2c4c9c8618a43b3"
2626
).decode("hex")
2727
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_)
28+
self.assertLess(
29+
nonce - proofofwork.trial_value(nonce, initialHash), target_)

0 commit comments

Comments
 (0)