* 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 |             Inserts a block into the network | ||||||
|             encryptType must be specified to encrypt a block |             encryptType must be specified to encrypt a block | ||||||
|         ''' |         ''' | ||||||
|  |         retData = False | ||||||
| 
 | 
 | ||||||
|         if meta is None: |         if meta is None: | ||||||
|             meta = dict() |             meta = dict() | ||||||
|  | @ -736,7 +737,7 @@ class Core: | ||||||
|         # send block data (and metadata) to POW module to get tokenized block data |         # send block data (and metadata) to POW module to get tokenized block data | ||||||
|         proof = onionrproofs.POW(metadata, data) |         proof = onionrproofs.POW(metadata, data) | ||||||
|         payload = proof.waitForResult() |         payload = proof.waitForResult() | ||||||
|          |         if payload != False: | ||||||
|             retData = self.setData(payload) |             retData = self.setData(payload) | ||||||
|             self.addToBlockDB(retData, selfInsert=True, dataSaved=True) |             self.addToBlockDB(retData, selfInsert=True, dataSaved=True) | ||||||
|             self.setBlockType(retData, meta['type']) |             self.setBlockType(retData, meta['type']) | ||||||
|  |  | ||||||
|  | @ -441,7 +441,7 @@ class Onionr: | ||||||
| 
 | 
 | ||||||
|         #addedHash = Block(type = 'txt', content = messageToAdd).save() |         #addedHash = Block(type = 'txt', content = messageToAdd).save() | ||||||
|         addedHash = self.onionrCore.insertBlock(messageToAdd) |         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) |             logger.info("Message inserted as as block %s" % addedHash) | ||||||
|         else: |         else: | ||||||
|             logger.error('Failed to insert block.', timestamp = False) |             logger.error('Failed to insert block.', timestamp = False) | ||||||
|  |  | ||||||
|  | @ -169,7 +169,7 @@ class OnionrUtils: | ||||||
|             retData = requests.get(payload).text |             retData = requests.get(payload).text | ||||||
|         except Exception as error: |         except Exception as error: | ||||||
|             if not silent: |             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 |             retData = False | ||||||
| 
 | 
 | ||||||
|         return retData |         return retData | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue