diff --git a/onionr/core.py b/onionr/core.py index 3cfa41d7..133a425c 100644 --- a/onionr/core.py +++ b/onionr/core.py @@ -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 diff --git a/onionr/onionr.py b/onionr/onionr.py index 5cb78de1..bf21b81b 100755 --- a/onionr/onionr.py +++ b/onionr/onionr.py @@ -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) diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py index 6e984bc2..c5b2929c 100644 --- a/onionr/onionrutils.py +++ b/onionr/onionrutils.py @@ -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