fixed bytes on new pow in older python versions
parent
0f69bfd295
commit
85fdcab534
|
@ -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 "$@"
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue