From e85683e40f0ab46fc2afe47ab7e5d4c109acc81a Mon Sep 17 00:00:00 2001 From: Jimmy Kiselak Date: Tue, 22 Mar 2016 22:42:45 -0400 Subject: [PATCH 1/2] show more informative messages when blockchain is catching up --- lbrynet/core/LBRYcrdWallet.py | 38 ++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/lbrynet/core/LBRYcrdWallet.py b/lbrynet/core/LBRYcrdWallet.py index 3c0c5f03f..9015da57f 100644 --- a/lbrynet/core/LBRYcrdWallet.py +++ b/lbrynet/core/LBRYcrdWallet.py @@ -893,6 +893,9 @@ class LBRYumWallet(LBRYWallet): self.cmd_runner = None self.first_run = False self.printed_retrieving_headers = False + self._start_check = None + self._catch_up_check = None + self._caught_up_counter = 0 def _start(self): @@ -912,21 +915,30 @@ class LBRYumWallet(LBRYWallet): alert.info("Running the wallet for the first time...this may take a moment.") self.printed_retrieving_headers = True return False - start_check.stop() + self._start_check.stop() + self._start_check = None if self.network.is_connected(): network_start_d.callback(True) else: network_start_d.errback(ValueError("Failed to connect to network.")) - start_check = task.LoopingCall(check_started) + self._start_check = task.LoopingCall(check_started) - d.addCallback(lambda _: start_check.start(.1)) + d.addCallback(lambda _: self._start_check.start(.1)) d.addCallback(lambda _: network_start_d) d.addCallback(lambda _: self._load_wallet()) d.addCallback(lambda _: self._get_cmd_runner()) return d def _stop(self): + if self._start_check is not None: + self._start_check.stop() + self._start_check = None + + if self._catch_up_check is not None: + self._catch_up_check.stop() + self._catch_up_check = None + d = defer.Deferred() def check_stopped(): @@ -964,16 +976,28 @@ class LBRYumWallet(LBRYWallet): remote_height = self.network.get_server_height() if remote_height != 0 and remote_height - local_height <= 5: - alert.info('Wallet loaded.') - catch_up_check.stop() + msg = "" + if self._caught_up_counter != 0: + msg += "All caught up. " + msg += "Wallet loaded." + alert.info(msg) + self._catch_up_check.stop() + self._catch_up_check = None blockchain_caught_d.callback(True) + elif remote_height != 0: + if self._caught_up_counter == 0: + alert.info('Catching up to the blockchain...showing blocks left...') + if self._caught_up_counter % 30 == 0: + alert.info('%d...', (remote_height - local_height)) + self._caught_up_counter += 1 - catch_up_check = task.LoopingCall(check_caught_up) + + self._catch_up_check = task.LoopingCall(check_caught_up) d = threads.deferToThread(get_wallet) d.addCallback(self._save_wallet) d.addCallback(lambda _: self.wallet.start_threads(self.network)) - d.addCallback(lambda _: catch_up_check.start(.1)) + d.addCallback(lambda _: self._catch_up_check.start(.1)) d.addCallback(lambda _: blockchain_caught_d) return d From 1ccd2a3cc9107d1cd17df66dc31019f3610ed5fd Mon Sep 17 00:00:00 2001 From: Jimmy Kiselak Date: Wed, 23 Mar 2016 22:02:02 -0400 Subject: [PATCH 2/2] do version better --- lbrynet/__init__.py | 3 ++- setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lbrynet/__init__.py b/lbrynet/__init__.py index f780625b8..eb4d8454c 100644 --- a/lbrynet/__init__.py +++ b/lbrynet/__init__.py @@ -4,4 +4,5 @@ import logging logging.getLogger(__name__).addHandler(logging.NullHandler()) -__version__ = (0, 2, 0) \ No newline at end of file +version = (0, 2, 0) +__version__ = ".".join([str(x) for x in version]) diff --git a/setup.py b/setup.py index ed9b2a866..4b8047d00 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ gui_data_files = ['close2.gif', 'lbry-dark-242x80.gif', 'lbry-dark-icon.xbm', 'l gui_data_paths = [os.path.join(base_dir, 'lbrynet', 'lbrynet_gui', f) for f in gui_data_files] setup(name='lbrynet', - version='.'.join([str(x) for x in __version__]), + version=__version__, packages=find_packages(base_dir), install_requires=['six>=1.9.0', 'pycrypto', 'twisted', 'miniupnpc', 'yapsy', 'seccure', 'python-bitcoinrpc==0.1', 'txJSON-RPC', 'requests>=2.4.2', 'unqlite==0.2.0', 'leveldb', 'lbryum'], entry_points={'console_scripts': console_scripts},