From 15877449f8115ef43d324620ad0c66f0017022dc Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Tue, 2 Oct 2018 11:45:56 -0500 Subject: [PATCH] bug fixes --- onionr/communicator2.py | 7 +++++-- onionr/onionrcrypto.py | 2 +- onionr/static-data/default-plugins/pms/main.py | 7 +++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/onionr/communicator2.py b/onionr/communicator2.py index 5a293c0f..c3a104f2 100755 --- a/onionr/communicator2.py +++ b/onionr/communicator2.py @@ -220,7 +220,7 @@ class OnionrCommunicatorDaemon: logger.info("Attempting to download %s..." % blockHash) peerUsed = self.pickOnlinePeer() content = self.peerAction(peerUsed, 'getData', data=blockHash) # block content from random peer (includes metadata) - if content != False: + if content != False and len(content) > 0: try: content = content.encode() except AttributeError: @@ -266,7 +266,10 @@ class OnionrCommunicatorDaemon: onionrpeers.PeerProfiles(peerUsed, self._core).addScore(-50) logger.warn('Block hash validation failed for ' + blockHash + ' got ' + tempHash) if removeFromQueue: - self.blockQueue.remove(blockHash) # remove from block queue both if success or false + try: + self.blockQueue.remove(blockHash) # remove from block queue both if success or false + except ValueError: + pass self.currentDownloading.remove(blockHash) self.decrementThreadCount('getBlocks') return diff --git a/onionr/onionrcrypto.py b/onionr/onionrcrypto.py index 8953bf8f..ab07edd2 100644 --- a/onionr/onionrcrypto.py +++ b/onionr/onionrcrypto.py @@ -76,7 +76,7 @@ class OnionrCrypto: try: key = nacl.signing.VerifyKey(key=key, encoder=nacl.encoding.Base32Encoder) except nacl.exceptions.ValueError: - logger.warn('Signature by unknown key (cannot reverse hash)') + #logger.debug('Signature by unknown key (cannot reverse hash)') return False except binascii.Error: logger.warn('Could not load key for verification, invalid padding') diff --git a/onionr/static-data/default-plugins/pms/main.py b/onionr/static-data/default-plugins/pms/main.py index f569ec9b..a47983b0 100644 --- a/onionr/static-data/default-plugins/pms/main.py +++ b/onionr/static-data/default-plugins/pms/main.py @@ -68,6 +68,7 @@ class OnionrMail: pmBlocks = {} logger.info('Decrypting messages...') choice = '' + displayList = [] # this could use a lot of memory if someone has recieved a lot of messages for blockHash in self.myCore.getBlocksByType('pm'): @@ -93,8 +94,10 @@ class OnionrMail: senderDisplay = senderKey blockDate = pmBlocks[blockHash].getDate().strftime("%m/%d %H:%M") - print('%s. %s - %s: %s' % (blockCount, blockDate, senderDisplay[:12], blockHash)) - + displayList.append('%s. %s - %s: %s' % (blockCount, blockDate, senderDisplay[:12], blockHash)) + #displayList.reverse() + for i in displayList: + print(i) try: choice = logger.readline('Enter a block number, -r to refresh, or -q to stop: ').strip().lower() except (EOFError, KeyboardInterrupt):