From 862b609687995efa556016e84045a746c9821886 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Thu, 19 Jul 2018 22:02:09 -0500 Subject: [PATCH] * reduce spam * another bytes fix for old python --- onionr/onionrblockapi.py | 9 +++++++-- onionr/onionrutils.py | 6 ++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/onionr/onionrblockapi.py b/onionr/onionrblockapi.py index e9b01b2d..695d41ab 100644 --- a/onionr/onionrblockapi.py +++ b/onionr/onionrblockapi.py @@ -81,7 +81,13 @@ class Block: if self.getHeader('encryptType') == 'asym': try: self.bcontent = core._crypto.pubKeyDecrypt(self.bcontent, anonymous=anonymous, encodedData=encodedData) - self.bmetadata = json.loads(core._crypto.pubKeyDecrypt(self.bmetadata, anonymous=anonymous, encodedData=encodedData)) + bmeta = core._crypto.pubKeyDecrypt(self.bmetadata, anonymous=anonymous, encodedData=encodedData) + try: + bmeta = bmeta.decode() + except AttributeError: + # yet another bytes fix + pass + self.bmetadata = json.loads(bmeta) self.signature = core._crypto.pubKeyDecrypt(self.signature, anonymous=anonymous, encodedData=encodedData) self.signer = core._crypto.pubKeyDecrypt(self.signer, anonymous=anonymous, encodedData=encodedData) self.signedData = json.dumps(self.bmetadata) + self.bcontent.decode() @@ -101,7 +107,6 @@ class Block: if core._crypto.edVerify(data=self.signedData, key=self.signer, sig=self.signature, encodedData=True): self.validSig = True - print('ded') else: self.validSig = False return self.validSig diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py index 64717a57..33e3f51d 100644 --- a/onionr/onionrutils.py +++ b/onionr/onionrutils.py @@ -117,7 +117,8 @@ class OnionrUtils: else: logger.warn("Failed to add key") else: - logger.debug('%s pow failed' % key[0]) + pass + #logger.debug('%s pow failed' % key[0]) return retVal except Exception as error: logger.error('Failed to merge keys.', error=error) @@ -137,7 +138,8 @@ class OnionrUtils: logger.info('Added %s to db.' % adder, timestamp = True) retVal = True else: - logger.debug('%s is either our address or already in our DB' % adder) + pass + #logger.debug('%s is either our address or already in our DB' % adder) return retVal except Exception as error: logger.error('Failed to merge adders.', error = error)