fixed bytes on new pow in older python versions

This commit is contained in:
Kevin Froman 2018-07-19 15:12:48 -05:00
parent 0f69bfd295
commit 85fdcab534
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
2 changed files with 7 additions and 4 deletions

View File

@ -1,3 +1,5 @@
#!/bin/sh
cd onionr/
cp -R static-data/default-plugins/pms/ data/plugins/
cp -R static-data/default-plugins/flow/ data/plugins/
./onionr.py "$@"

View File

@ -159,10 +159,11 @@ class POW:
self.metadata['powRandomToken'] = base64.b64encode(rand).decode()
payload = json.dumps(self.metadata).encode() + b'\n' + self.data
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)
try:
# on some versions, token is bytes
token = token.decode()
except AttributeError:
pass
if self.puzzle == token[0:self.difficulty]:
self.hashing = False
iFound = True