bug fixes

This commit is contained in:
Kevin Froman 2018-10-02 11:45:56 -05:00
parent 0b9bb42927
commit 15877449f8
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
3 changed files with 11 additions and 5 deletions

View File

@ -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

View File

@ -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')

View File

@ -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):