From f0e842eae4c6d71efda3c23545141510e3257c38 Mon Sep 17 00:00:00 2001 From: Arinerron Date: Sat, 12 May 2018 23:37:47 -0700 Subject: [PATCH] Fix positional argument bug --- onionr/communicator.py | 9 +++------ onionr/onionrcrypto.py | 2 +- onionr/onionrpluginapi.py | 4 ++-- onionr/static-data/default-plugins/pluginmanager/main.py | 4 ++-- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/onionr/communicator.py b/onionr/communicator.py index 2c66e2ac..3980472f 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -447,7 +447,7 @@ class OnionrCommunicate: if isThread: self.lookupBlocksThreads += 1 peerList = self._core.listAdders() - blocks = '' + blockList = list() for i in peerList: if self.peerStatusTaken(i, 'getBlockHashes') or self.peerStatusTaken(i, 'getDBHash'): @@ -476,18 +476,15 @@ class OnionrCommunicate: if lastDB != currentDB: logger.debug('Fetching hash from %s - %s current hash.' % (str(i), currentDB)) try: - blocks += self.performGet('getBlockHashes', i) + blockList.append(self.performGet('getBlockHashes', i)) except TypeError: logger.warn('Failed to get data hash from %s' % str(i)) self.peerData[i]['failCount'] -= 1 if self._utils.validateHash(currentDB): self._core.setAddressInfo(i, "DBHash", currentDB) - if len(blocks.strip()) != 0: + if len(blockList) != 0: pass - #logger.debug('BLOCKS:' + blocks) - - blockList = blocks.split('\n') for i in blockList: if len(i.strip()) == 0: diff --git a/onionr/onionrcrypto.py b/onionr/onionrcrypto.py index 315a7b2f..590122f1 100644 --- a/onionr/onionrcrypto.py +++ b/onionr/onionrcrypto.py @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . ''' -import nacl.signing, nacl.encoding, nacl.public, nacl.hash, nacl.secret, os, binascii, base64, hashlib, logger, onionrproofs, time +import nacl.signing, nacl.encoding, nacl.public, nacl.hash, nacl.secret, os, binascii, base64, hashlib, logger, onionrproofs, time, math class OnionrCrypto: def __init__(self, coreInstance): diff --git a/onionr/onionrpluginapi.py b/onionr/onionrpluginapi.py index 51fca1a9..95f06e46 100644 --- a/onionr/onionrpluginapi.py +++ b/onionr/onionrpluginapi.py @@ -153,8 +153,8 @@ class pluginapi: def get_utils(self): return self.get_onionr().onionrUtils - def get_crypto(): - return self.get_core().crypto + def get_crypto(self): + return self.get_core()._crypto def get_daemonapi(self): return self.daemon diff --git a/onionr/static-data/default-plugins/pluginmanager/main.py b/onionr/static-data/default-plugins/pluginmanager/main.py index fb330fd6..bbe8f9b4 100644 --- a/onionr/static-data/default-plugins/pluginmanager/main.py +++ b/onionr/static-data/default-plugins/pluginmanager/main.py @@ -97,13 +97,13 @@ def parseBlock(hash, key):# deal with block metadata blockContent = pluginapi.get_core().getData(hash) try: - blockMetadata = json.loads(blockContent[:blockContent.decode().find(b'}') + 1].decode()) + blockMetadata = json.loads(blockContent[:blockContent.decode().find('\n')].decode()) try: blockMeta2 = json.loads(blockMetadata['meta']) except KeyError: blockMeta2 = {'type': ''} pass - blockContent = blockContent[blockContent.rfind(b'}') + 1:] + blockContent = blockContent[blockContent.rfind(b'\n') + 1:] try: blockContent = blockContent.decode() except AttributeError: