Fix positional argument bug

master
Arinerron 2018-05-12 23:37:47 -07:00
parent 71f4318719
commit f0e842eae4
No known key found for this signature in database
GPG Key ID: 99383627861C62F0
4 changed files with 8 additions and 11 deletions

View File

@ -447,7 +447,7 @@ class OnionrCommunicate:
if isThread: if isThread:
self.lookupBlocksThreads += 1 self.lookupBlocksThreads += 1
peerList = self._core.listAdders() peerList = self._core.listAdders()
blocks = '' blockList = list()
for i in peerList: for i in peerList:
if self.peerStatusTaken(i, 'getBlockHashes') or self.peerStatusTaken(i, 'getDBHash'): if self.peerStatusTaken(i, 'getBlockHashes') or self.peerStatusTaken(i, 'getDBHash'):
@ -476,18 +476,15 @@ class OnionrCommunicate:
if lastDB != currentDB: if lastDB != currentDB:
logger.debug('Fetching hash from %s - %s current hash.' % (str(i), currentDB)) logger.debug('Fetching hash from %s - %s current hash.' % (str(i), currentDB))
try: try:
blocks += self.performGet('getBlockHashes', i) blockList.append(self.performGet('getBlockHashes', i))
except TypeError: except TypeError:
logger.warn('Failed to get data hash from %s' % str(i)) logger.warn('Failed to get data hash from %s' % str(i))
self.peerData[i]['failCount'] -= 1 self.peerData[i]['failCount'] -= 1
if self._utils.validateHash(currentDB): if self._utils.validateHash(currentDB):
self._core.setAddressInfo(i, "DBHash", currentDB) self._core.setAddressInfo(i, "DBHash", currentDB)
if len(blocks.strip()) != 0: if len(blockList) != 0:
pass pass
#logger.debug('BLOCKS:' + blocks)
blockList = blocks.split('\n')
for i in blockList: for i in blockList:
if len(i.strip()) == 0: if len(i.strip()) == 0:

View File

@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
''' '''
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: class OnionrCrypto:
def __init__(self, coreInstance): def __init__(self, coreInstance):

View File

@ -153,8 +153,8 @@ class pluginapi:
def get_utils(self): def get_utils(self):
return self.get_onionr().onionrUtils return self.get_onionr().onionrUtils
def get_crypto(): def get_crypto(self):
return self.get_core().crypto return self.get_core()._crypto
def get_daemonapi(self): def get_daemonapi(self):
return self.daemon return self.daemon

View File

@ -97,13 +97,13 @@ def parseBlock(hash, key):# deal with block metadata
blockContent = pluginapi.get_core().getData(hash) blockContent = pluginapi.get_core().getData(hash)
try: try:
blockMetadata = json.loads(blockContent[:blockContent.decode().find(b'}') + 1].decode()) blockMetadata = json.loads(blockContent[:blockContent.decode().find('\n')].decode())
try: try:
blockMeta2 = json.loads(blockMetadata['meta']) blockMeta2 = json.loads(blockMetadata['meta'])
except KeyError: except KeyError:
blockMeta2 = {'type': ''} blockMeta2 = {'type': ''}
pass pass
blockContent = blockContent[blockContent.rfind(b'}') + 1:] blockContent = blockContent[blockContent.rfind(b'\n') + 1:]
try: try:
blockContent = blockContent.decode() blockContent = blockContent.decode()
except AttributeError: except AttributeError: