* do not report inserted message if keyboard interrupt/failure

* do not crash on keyboard interrupt in pow
master
Kevin Froman 2018-07-09 22:09:45 -05:00
parent b3b5e5bb50
commit 9083775887
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
3 changed files with 7 additions and 6 deletions

View File

@ -674,6 +674,7 @@ class Core:
Inserts a block into the network
encryptType must be specified to encrypt a block
'''
retData = False
if meta is None:
meta = dict()
@ -736,10 +737,10 @@ class Core:
# send block data (and metadata) to POW module to get tokenized block data
proof = onionrproofs.POW(metadata, data)
payload = proof.waitForResult()
retData = self.setData(payload)
self.addToBlockDB(retData, selfInsert=True, dataSaved=True)
self.setBlockType(retData, meta['type'])
if payload != False:
retData = self.setData(payload)
self.addToBlockDB(retData, selfInsert=True, dataSaved=True)
self.setBlockType(retData, meta['type'])
return retData

View File

@ -441,7 +441,7 @@ class Onionr:
#addedHash = Block(type = 'txt', content = messageToAdd).save()
addedHash = self.onionrCore.insertBlock(messageToAdd)
if addedHash != None:
if addedHash != None and addedHash != False and addedHash != "":
logger.info("Message inserted as as block %s" % addedHash)
else:
logger.error('Failed to insert block.', timestamp = False)

View File

@ -169,7 +169,7 @@ class OnionrUtils:
retData = requests.get(payload).text
except Exception as error:
if not silent:
logger.debug('Failed to make local request (command: %s).' % command, error=error)
logger.error('Failed to make local request (command: %s):%s' % (command, error))
retData = False
return retData