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 #!/bin/sh
cd onionr/ cd onionr/
cp -R static-data/default-plugins/pms/ data/plugins/
cp -R static-data/default-plugins/flow/ data/plugins/
./onionr.py "$@" ./onionr.py "$@"

View File

@ -159,10 +159,11 @@ 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: try:
# crypto.sha3Hash returns bytes on some older python versions # on some versions, token is bytes
self.puzzle = self.puzzle.encode() token = token.decode()
#print(token) except AttributeError:
pass
if self.puzzle == token[0:self.difficulty]: if self.puzzle == token[0:self.difficulty]:
self.hashing = False self.hashing = False
iFound = True iFound = True