From b5fecdf1e839def7b5f7a6314e085e004c3721e5 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Wed, 26 Sep 2018 20:37:52 -0500 Subject: [PATCH] logging is less spammy, file disabled by default, and we dont try to scan encrypted blocks that aren't for us --- onionr/api.py | 2 +- onionr/onionrutils.py | 23 +++++++++++++---------- onionr/static-data/default_config.json | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/onionr/api.py b/onionr/api.py index 79df9451..146d43c5 100755 --- a/onionr/api.py +++ b/onionr/api.py @@ -515,7 +515,7 @@ class API: while len(self._core.hsAddress) == 0: self._core.refreshFirstStartVars() time.sleep(0.5) - self.http_server = WSGIServer((self.host, bindPort), app) + self.http_server = WSGIServer((self.host, bindPort), app, log=None) self.http_server.serve_forever() except KeyboardInterrupt: pass diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py index ba8d6b42..f5820059 100644 --- a/onionr/onionrutils.py +++ b/onionr/onionrutils.py @@ -263,18 +263,21 @@ class OnionrUtils: myBlock = Block(blockHash, self._core) if myBlock.isEncrypted: myBlock.decrypt() - blockType = myBlock.getMetadata('type') # we would use myBlock.getType() here, but it is bugged with encrypted blocks - signer = self.bytesToStr(myBlock.signer) - valid = myBlock.verifySig() - try: - if len(blockType) <= 10: - self._core.updateBlockInfo(blockHash, 'dataType', blockType) + if myBlock.decrypted: + blockType = myBlock.getMetadata('type') # we would use myBlock.getType() here, but it is bugged with encrypted blocks + signer = self.bytesToStr(myBlock.signer) + valid = myBlock.verifySig() + try: + if len(blockType) <= 10: + self._core.updateBlockInfo(blockHash, 'dataType', blockType) - onionrevents.event('processblocks', data = {'block': myBlock, 'type': blockType, 'signer': signer, 'validSig': valid}, onionr = None) + onionrevents.event('processblocks', data = {'block': myBlock, 'type': blockType, 'signer': signer, 'validSig': valid}, onionr = None) - except TypeError: - logger.warn("Missing block information") - pass + except TypeError: + logger.warn("Missing block information") + pass + else: + logger.debug('Not processing metadata on encrypted block we cannot decrypt.') def escapeAnsi(self, line): ''' diff --git a/onionr/static-data/default_config.json b/onionr/static-data/default_config.json index 5ebcfa4a..de27f4c1 100644 --- a/onionr/static-data/default_config.json +++ b/onionr/static-data/default_config.json @@ -30,7 +30,7 @@ "log": { "file": { - "output": true, + "output": false, "path": "data/output.log" },