fixed bytes issue with new pow and older python

master
Kevin Froman 2018-07-19 14:46:13 -05:00
parent 3b04771eb7
commit 0f69bfd295
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
1 changed files with 3 additions and 0 deletions

View File

@ -159,6 +159,9 @@ class POW:
self.metadata['powRandomToken'] = base64.b64encode(rand).decode() self.metadata['powRandomToken'] = base64.b64encode(rand).decode()
payload = json.dumps(self.metadata).encode() + b'\n' + self.data payload = json.dumps(self.metadata).encode() + b'\n' + self.data
token = myCore._crypto.sha3Hash(payload) token = myCore._crypto.sha3Hash(payload)
if type(token) is bytes:
# crypto.sha3Hash returns bytes on some older python versions
self.puzzle = self.puzzle.encode()
#print(token) #print(token)
if self.puzzle == token[0:self.difficulty]: if self.puzzle == token[0:self.difficulty]:
self.hashing = False self.hashing = False