work on mail settings, onionruser own key adding bug fix
This commit is contained in:
		
							parent
							
								
									862c6f2ea4
								
							
						
					
					
						commit
						b62e613e8e
					
				
					 8 changed files with 25 additions and 24 deletions
				
			
		|  | @ -11,6 +11,7 @@ from onionrcrypto import hashers | |||
| from onionrutils import bytesconverter | ||||
| from onionrutils import mnemonickeys | ||||
| from onionrtypes import JSONSerializable | ||||
| 
 | ||||
| """ | ||||
|     This program is free software: you can redistribute it and/or modify | ||||
|     it under the terms of the GNU General Public License as published by | ||||
|  |  | |||
|  | @ -36,7 +36,6 @@ from onionrproofs import subprocesspow | |||
| import logger | ||||
| from onionrtypes import UserIDSecretKey | ||||
| 
 | ||||
| 
 | ||||
| def _check_upload_queue(): | ||||
|     """Returns the current upload queue len | ||||
|     raises OverflowError if max, false if api not running | ||||
|  |  | |||
|  | @ -10,6 +10,7 @@ from multiprocessing import Pipe, Process | |||
| import threading | ||||
| import time | ||||
| import json | ||||
| import secrets | ||||
| 
 | ||||
| import logger | ||||
| import onionrproofs | ||||
|  | @ -109,7 +110,7 @@ class SubprocessPOW: | |||
| 
 | ||||
|     def do_pow(self, pipe): | ||||
|         """find partial hash colision generating nonce for a block""" | ||||
|         nonce = BLOCK_NONCE_START_INT | ||||
|         nonce = -secrets.randbelow(10**10) | ||||
|         data = self.data | ||||
|         metadata = self.metadata | ||||
|         puzzle = self.puzzle | ||||
|  |  | |||
|  | @ -23,6 +23,7 @@ import unpaddedbase32 | |||
| import nacl.exceptions | ||||
| from coredb import keydb, dbfiles | ||||
| import onionrcrypto | ||||
| from onionrcrypto import getourkeypair | ||||
| 
 | ||||
| def deleteExpiredKeys(): | ||||
|     # Fetch the keys we generated for the peer, that are still around | ||||
|  | @ -54,8 +55,8 @@ class OnionrUser: | |||
| 
 | ||||
|     def __init__(self, publicKey, saveUser=False): | ||||
|         ''' | ||||
|             OnionrUser is an abstraction for "users" of the network.  | ||||
|              | ||||
|             OnionrUser is an abstraction for "users" of the network. | ||||
| 
 | ||||
|             Takes a base32 encoded ed25519 public key, and a bool saveUser | ||||
|             saveUser determines if we should add a user to our peer database or not. | ||||
|         ''' | ||||
|  | @ -64,7 +65,7 @@ class OnionrUser: | |||
|         self.trust = 0 | ||||
|         self.publicKey = publicKey | ||||
| 
 | ||||
|         if saveUser: | ||||
|         if saveUser and not publicKey == getourkeypair.get_keypair(): | ||||
|             try: | ||||
|                 keydb.addkeys.add_peer(publicKey) | ||||
|             except (AssertionError, ValueError) as e: | ||||
|  | @ -220,7 +221,7 @@ class OnionrUser: | |||
|         conn.commit() | ||||
|         conn.close() | ||||
|         return True | ||||
|      | ||||
| 
 | ||||
|     @classmethod | ||||
|     def list_friends(cls): | ||||
|         friendList = [] | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ from onionrplugins import onionrevents | |||
| import onionrexceptions | ||||
| from onionrusers import onionrusers | ||||
| from onionrutils import updater | ||||
| from gevent import sleep | ||||
| 
 | ||||
| def process_block_metadata(blockHash: str): | ||||
|     ''' | ||||
|  | @ -37,8 +38,8 @@ def process_block_metadata(blockHash: str): | |||
|     curTime = epoch.get_rounded_epoch(roundS=60) | ||||
|     myBlock = onionrblockapi.Block(blockHash) | ||||
|     if myBlock.isEncrypted: | ||||
|         print(myBlock.hash, myBlock.decrypt()) | ||||
|     if myBlock.decrypted or not myBlock.isEncrypted: | ||||
|         myBlock.decrypt() | ||||
|     if (myBlock.isEncrypted and myBlock.decrypted) or (not myBlock.isEncrypted): | ||||
|         blockType = myBlock.getMetadata('type') # we would use myBlock.getType() here, but it is bugged with encrypted blocks | ||||
| 
 | ||||
|         signer = bytesconverter.bytes_to_str(myBlock.signer) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue