forked from LBRYCommunity/lbry-sdk
fix division by zero error
This commit is contained in:
parent
166bf65e88
commit
c85127d76b
1 changed files with 4 additions and 1 deletions
|
@ -132,6 +132,9 @@ class WalletComponent(Component):
|
||||||
remote_height = self.wallet_manager.ledger.network.remote_height
|
remote_height = self.wallet_manager.ledger.network.remote_height
|
||||||
target_height = remote_height - disk_height if disk_height != local_height else remote_height
|
target_height = remote_height - disk_height if disk_height != local_height else remote_height
|
||||||
best_hash = self.wallet_manager.get_best_blockhash()
|
best_hash = self.wallet_manager.get_best_blockhash()
|
||||||
|
if not target_height:
|
||||||
|
progress = 100
|
||||||
|
else:
|
||||||
progress = min(max(math.ceil(float(download_height) / float(target_height) * 100), 0), 100)
|
progress = min(max(math.ceil(float(download_height) / float(target_height) * 100), 0), 100)
|
||||||
result.update({
|
result.update({
|
||||||
'headers_synchronization_progress': progress,
|
'headers_synchronization_progress': progress,
|
||||||
|
|
Loading…
Reference in a new issue