From 85fdcab53474028ff8b15e0e53ff3ccc2c97dbdf Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Thu, 19 Jul 2018 15:12:48 -0500 Subject: [PATCH] fixed bytes on new pow in older python versions --- RUN-LINUX.sh | 2 ++ onionr/onionrproofs.py | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/RUN-LINUX.sh b/RUN-LINUX.sh index 8f9a4b37..9de398cd 100755 --- a/RUN-LINUX.sh +++ b/RUN-LINUX.sh @@ -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 "$@" diff --git a/onionr/onionrproofs.py b/onionr/onionrproofs.py index 04746508..194b37e9 100644 --- a/onionr/onionrproofs.py +++ b/onionr/onionrproofs.py @@ -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