diff --git a/onionr/communicator.py b/onionr/communicator.py index 47f8e5d6..ef94ae14 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -149,8 +149,13 @@ class OnionrCommunicatorDaemon: pass logger.info('Goodbye.') - for server in self.service_greenlets: - server.stop() + try: + self.service_greenlets + except AttributeError: + pass + else: + for server in self.service_greenlets: + server.stop() self._core._utils.localCommand('shutdown') # shutdown the api time.sleep(0.5) diff --git a/onionr/etc/onionrvalues.py b/onionr/etc/onionrvalues.py index 84203d88..338dc0d3 100755 --- a/onionr/etc/onionrvalues.py +++ b/onionr/etc/onionrvalues.py @@ -21,4 +21,5 @@ class OnionrValues: def __init__(self): self.passwordLength = 20 - self.blockMetadataLengths = {'meta': 1000, 'sig': 200, 'signer': 200, 'time': 10, 'powRandomToken': 1000, 'encryptType': 4, 'expire': 14} #TODO properly refine values to minimum needed \ No newline at end of file + self.blockMetadataLengths = {'meta': 1000, 'sig': 200, 'signer': 200, 'time': 10, 'powRandomToken': 1000, 'encryptType': 4, 'expire': 14} #TODO properly refine values to minimum needed + self.default_expire = 2678400 \ No newline at end of file diff --git a/onionr/onionrutils.py b/onionr/onionrutils.py index b9ae61c4..ea56b593 100755 --- a/onionr/onionrutils.py +++ b/onionr/onionrutils.py @@ -25,7 +25,7 @@ import onionrexceptions from onionr import API_VERSION import onionrevents import storagecounter -from etc import pgpwords +from etc import pgpwords, onionrvalues from onionrusers import onionrusers if sys.version_info < (3, 6): try: @@ -179,8 +179,8 @@ class OnionrUtils: expireTime = myBlock.getHeader('expire') assert len(str(int(expireTime))) < 20 # test that expire time is an integer of sane length (for epoch) except (AssertionError, ValueError, TypeError) as e: - pass - else: + expireTime = onionrvalues.OnionrValues().default_expire + finally: self._core.updateBlockInfo(blockHash, 'expire', expireTime) if not blockType is None: self._core.updateBlockInfo(blockHash, 'dataType', blockType) @@ -253,7 +253,7 @@ class OnionrUtils: pass # Validate metadata dict for invalid keys to sizes that are too large - maxAge = config.get("general.max_block_age", 2678400) + maxAge = config.get("general.max_block_age", onionrvalues.OnionrValues().default_expire) if type(metadata) is dict: for i in metadata: try: @@ -285,7 +285,7 @@ class OnionrUtils: try: assert int(metadata[i]) > self.getEpoch() except AssertionError: - logger.warn('Block is expired: %s greater than %s' % (metadata[i], self.getEpoch())) + logger.warn('Block is expired: %s less than %s' % (metadata[i], self.getEpoch())) break elif i == 'encryptType': try: diff --git a/onionr/static-data/bootstrap-nodes.txt b/onionr/static-data/bootstrap-nodes.txt index e69de29b..374ea7b4 100755 --- a/onionr/static-data/bootstrap-nodes.txt +++ b/onionr/static-data/bootstrap-nodes.txt @@ -0,0 +1 @@ +huei7fugyuesltkf3yzj27an36skz2f2u55g7ganyaq6yjhauwicwfyd.onion diff --git a/onionr/static-data/default-plugins/clandestine/main.py b/onionr/static-data/default-plugins/clandestine/main.py index bc7ca112..93bfd2d3 100755 --- a/onionr/static-data/default-plugins/clandestine/main.py +++ b/onionr/static-data/default-plugins/clandestine/main.py @@ -19,7 +19,7 @@ ''' # Imports some useful libraries -import locale +import locale, sys, os locale.setlocale(locale.LC_ALL, '')