* do not report inserted message if keyboard interrupt/failure
* do not crash on keyboard interrupt in pow
This commit is contained in:
		
							parent
							
								
									b3b5e5bb50
								
							
						
					
					
						commit
						9083775887
					
				
					 3 changed files with 7 additions and 6 deletions
				
			
		|  | @ -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,7 +737,7 @@ class Core: | |||
|         # send block data (and metadata) to POW module to get tokenized block data | ||||
|         proof = onionrproofs.POW(metadata, data) | ||||
|         payload = proof.waitForResult() | ||||
|          | ||||
|         if payload != False: | ||||
|             retData = self.setData(payload) | ||||
|             self.addToBlockDB(retData, selfInsert=True, dataSaved=True) | ||||
|             self.setBlockType(retData, meta['type']) | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue