From 71aadb7767cb21ee863474ee79fca4e7f8d08e41 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Mon, 22 Apr 2019 21:02:09 -0500 Subject: [PATCH] fixed dumb print leftover spamming hashes --- onionr/api.py | 13 +++++++------ onionr/communicator.py | 2 +- onionr/core.py | 2 +- onionr/onionrplugins.py | 6 ++++-- onionr/onionrproofs.py | 1 - onionr/onionrutils.py | 2 +- onionr/static-data/bootstrap-nodes.txt | 1 - onionr/static-data/default_config.json | 1 + 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/onionr/api.py b/onionr/api.py index c9b3a865..a77e95aa 100755 --- a/onionr/api.py +++ b/onionr/api.py @@ -114,10 +114,11 @@ class PublicAPI: # Provide a list of our blocks, with a date offset dateAdjust = request.args.get('date') bList = clientAPI._core.getBlockList(dateRec=dateAdjust) - for b in self.hideBlocks: - if b in bList: - # Don't share blocks we created if they haven't been *uploaded* yet, makes it harder to find who created a block - bList.remove(b) + if config.get('general.hide_created_blocks', True): + for b in self.hideBlocks: + if b in bList: + # Don't share blocks we created if they haven't been *uploaded* yet, makes it harder to find who created a block + bList.remove(b) return Response('\n'.join(bList)) @app.route('/getdata/') @@ -126,7 +127,7 @@ class PublicAPI: resp = '' data = name if clientAPI._utils.validateHash(data): - if data not in self.hideBlocks: + if not config.get('general.hide_created_blocks', True) or data not in self.hideBlocks: if data in clientAPI._core.getBlockList(): block = clientAPI.getBlockData(data, raw=True) try: @@ -244,7 +245,7 @@ class API: ''' Initialize the api server, preping variables for later use - This initilization defines all of the API entry points and handlers for the endpoints and errors + This initialization defines all of the API entry points and handlers for the endpoints and errors This also saves the used host (random localhost IP address) to the data folder in host.txt ''' diff --git a/onionr/communicator.py b/onionr/communicator.py index 24907cf2..94f8a4fa 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -621,7 +621,7 @@ class OnionrCommunicatorDaemon: def detectAPICrash(self): '''exit if the api server crashes/stops''' if self._core._utils.localCommand('ping', silent=False) not in ('pong', 'pong!'): - for i in range(12): + for i in range(20): if self._core._utils.localCommand('ping') in ('pong', 'pong!') or self.shutdown: break # break for loop time.sleep(1) diff --git a/onionr/core.py b/onionr/core.py index 47f00fa7..3c04ceb4 100755 --- a/onionr/core.py +++ b/onionr/core.py @@ -692,7 +692,7 @@ class Core: createTime = self._utils.getRoundedEpoch() # check nonce - print(data) + #print(data) dataNonce = self._utils.bytesToStr(self._crypto.sha3Hash(data)) try: with open(self.dataNonceFile, 'r') as nonces: diff --git a/onionr/onionrplugins.py b/onionr/onionrplugins.py index 7595805b..1a7c18d8 100755 --- a/onionr/onionrplugins.py +++ b/onionr/onionrplugins.py @@ -260,6 +260,8 @@ def check(): if not os.path.exists(os.path.dirname(get_plugins_folder())): logger.debug('Generating plugin data folder...') - os.makedirs(os.path.dirname(get_plugins_folder())) - + try: + os.makedirs(os.path.dirname(get_plugins_folder())) + except FileExistsError: + pass return diff --git a/onionr/onionrproofs.py b/onionr/onionrproofs.py index 53c6d881..bd0600cf 100755 --- a/onionr/onionrproofs.py +++ b/onionr/onionrproofs.py @@ -259,7 +259,6 @@ class POW: self.hashing = False iFound = True self.result = payload - print('count', nonce - startNonce) break nonce += 1 diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py index 2637b905..27c7fa2b 100755 --- a/onionr/onionrutils.py +++ b/onionr/onionrutils.py @@ -157,7 +157,6 @@ class OnionrUtils: ''' Read metadata from a block and cache it to the block database ''' - onionrevents.event('processblocks', data = {'block': myBlock, 'type': blockType, 'signer': signer, 'validSig': valid}, onionr = None) curTime = self.getRoundedEpoch(roundS=60) myBlock = Block(blockHash, self._core) if myBlock.isEncrypted: @@ -185,6 +184,7 @@ class OnionrUtils: self._core.updateBlockInfo(blockHash, 'expire', expireTime) if not blockType is None: self._core.updateBlockInfo(blockHash, 'dataType', blockType) + onionrevents.event('processblocks', data = {'block': myBlock, 'type': blockType, 'signer': signer, 'validSig': valid}, onionr = None) else: pass #logger.debug('Not processing metadata on encrypted block we cannot decrypt.') diff --git a/onionr/static-data/bootstrap-nodes.txt b/onionr/static-data/bootstrap-nodes.txt index 52622b12..e69de29b 100755 --- a/onionr/static-data/bootstrap-nodes.txt +++ b/onionr/static-data/bootstrap-nodes.txt @@ -1 +0,0 @@ -ecaufnpxx67xmvzwcriohapmmnqbj665h3ynemvwrr2juxl5oa5g7cad.onion diff --git a/onionr/static-data/default_config.json b/onionr/static-data/default_config.json index 988e91f0..aba71a3f 100755 --- a/onionr/static-data/default_config.json +++ b/onionr/static-data/default_config.json @@ -6,6 +6,7 @@ "minimum_send_pow": 4, "socket_servers": false, "security_level": 0, + "hide_created_blocks": true, "max_block_age": 2678400, "bypass_tor_check": false, "public_key": "",