From 6fcb4d93c9aa3771f4cdd34aa670b01d6bd914fc Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Wed, 16 Oct 2019 10:30:07 -0300 Subject: [PATCH] header component now shows header synchronization progress --- lbry/lbry/extras/daemon/Components.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lbry/lbry/extras/daemon/Components.py b/lbry/lbry/extras/daemon/Components.py index c5ee91813..a1b3bd5a6 100644 --- a/lbry/lbry/extras/daemon/Components.py +++ b/lbry/lbry/extras/daemon/Components.py @@ -1,3 +1,4 @@ +import math import os import asyncio import logging @@ -110,6 +111,7 @@ class WalletComponent(Component): local_height = self.wallet_manager.ledger.local_height_including_downloaded_height remote_height = self.wallet_manager.ledger.network.remote_height best_hash = self.wallet_manager.get_best_blockhash() + progress = min(max(math.ceil(float(local_height) / float(remote_height) * 100), 0), 100) return { 'connected_servers': [ { @@ -119,6 +121,7 @@ class WalletComponent(Component): } for session in self.wallet_manager.ledger.network.session_pool.sessions if session and session.available ], + 'headers_synchronization_progress': progress, 'blocks': max(local_height, 0), 'blocks_behind': max(remote_height - local_height, 0), 'best_blockhash': best_hash,