forked from LBRYCommunity/lbry-sdk
refactor header progress
This commit is contained in:
parent
ec8a61c3af
commit
54d0473e85
1 changed files with 4 additions and 4 deletions
|
@ -135,11 +135,11 @@ class WalletComponent(Component):
|
||||||
local_height = self.wallet_manager.ledger.local_height_including_downloaded_height
|
local_height = self.wallet_manager.ledger.local_height_including_downloaded_height
|
||||||
disk_height = len(self.wallet_manager.ledger.headers)
|
disk_height = len(self.wallet_manager.ledger.headers)
|
||||||
remote_height = self.wallet_manager.ledger.network.remote_height
|
remote_height = self.wallet_manager.ledger.network.remote_height
|
||||||
if disk_height != local_height != remote_height:
|
download_height, target_height = local_height - disk_height, remote_height - disk_height
|
||||||
download_height, target_height = local_height - disk_height, remote_height - disk_height
|
if target_height > 0:
|
||||||
|
progress = min(max(math.ceil(float(download_height) / float(target_height) * 100), 0), 100)
|
||||||
else:
|
else:
|
||||||
download_height, target_height = local_height, remote_height
|
progress = 100
|
||||||
progress = min(max(math.ceil(float(download_height) / float(target_height) * 100), 0), 100)
|
|
||||||
best_hash = self.wallet_manager.get_best_blockhash()
|
best_hash = self.wallet_manager.get_best_blockhash()
|
||||||
result.update({
|
result.update({
|
||||||
'headers_synchronization_progress': progress,
|
'headers_synchronization_progress': progress,
|
||||||
|
|
Loading…
Reference in a new issue