mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
network: trivial clean-up
This commit is contained in:
parent
7a46bd1089
commit
a89e67eeed
2 changed files with 10 additions and 8 deletions
|
@ -194,18 +194,18 @@ class Daemon(DaemonThread):
|
||||||
response = False
|
response = False
|
||||||
elif sub == 'status':
|
elif sub == 'status':
|
||||||
if self.network:
|
if self.network:
|
||||||
p = self.network.get_parameters()
|
net_params = self.network.get_parameters()
|
||||||
current_wallet = self.cmd_runner.wallet
|
current_wallet = self.cmd_runner.wallet
|
||||||
current_wallet_path = current_wallet.storage.path \
|
current_wallet_path = current_wallet.storage.path \
|
||||||
if current_wallet else None
|
if current_wallet else None
|
||||||
response = {
|
response = {
|
||||||
'path': self.network.config.path,
|
'path': self.network.config.path,
|
||||||
'server': p[0],
|
'server': net_params.host,
|
||||||
'blockchain_height': self.network.get_local_height(),
|
'blockchain_height': self.network.get_local_height(),
|
||||||
'server_height': self.network.get_server_height(),
|
'server_height': self.network.get_server_height(),
|
||||||
'spv_nodes': len(self.network.get_interfaces()),
|
'spv_nodes': len(self.network.get_interfaces()),
|
||||||
'connected': self.network.is_connected(),
|
'connected': self.network.is_connected(),
|
||||||
'auto_connect': p[4],
|
'auto_connect': net_params.auto_connect,
|
||||||
'version': ELECTRUM_VERSION,
|
'version': ELECTRUM_VERSION,
|
||||||
'wallets': {k: w.is_up_to_date()
|
'wallets': {k: w.is_up_to_date()
|
||||||
for k, w in self.wallets.items()},
|
for k, w in self.wallets.items()},
|
||||||
|
|
|
@ -299,7 +299,7 @@ class Network(PrintError):
|
||||||
lh = self.get_local_height()
|
lh = self.get_local_height()
|
||||||
result = (lh - sh) > 1
|
result = (lh - sh) > 1
|
||||||
if result:
|
if result:
|
||||||
self.print_error('%s is lagging (%d vs %d)' % (self.default_server, sh, lh))
|
self.print_error(f'{self.default_server} is lagging ({sh} vs {lh})')
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _set_status(self, status):
|
def _set_status(self, status):
|
||||||
|
@ -350,13 +350,15 @@ class Network(PrintError):
|
||||||
for i in FEE_ETA_TARGETS:
|
for i in FEE_ETA_TARGETS:
|
||||||
fee_tasks.append((i, await group.spawn(session.send_request('blockchain.estimatefee', [i]))))
|
fee_tasks.append((i, await group.spawn(session.send_request('blockchain.estimatefee', [i]))))
|
||||||
self.config.mempool_fees = histogram = histogram_task.result()
|
self.config.mempool_fees = histogram = histogram_task.result()
|
||||||
self.print_error('fee_histogram', histogram)
|
self.print_error(f'fee_histogram {histogram}')
|
||||||
self.notify('fee_histogram')
|
self.notify('fee_histogram')
|
||||||
for i, task in fee_tasks:
|
fee_estimates_eta = {}
|
||||||
|
for nblock_target, task in fee_tasks:
|
||||||
fee = int(task.result() * COIN)
|
fee = int(task.result() * COIN)
|
||||||
self.print_error("fee_estimates[%d]" % i, fee)
|
fee_estimates_eta[nblock_target] = fee
|
||||||
if fee < 0: continue
|
if fee < 0: continue
|
||||||
self.config.update_fee_estimates(i, fee)
|
self.config.update_fee_estimates(nblock_target, fee)
|
||||||
|
self.print_error(f'fee_estimates {fee_estimates_eta}')
|
||||||
self.notify('fee')
|
self.notify('fee')
|
||||||
|
|
||||||
def get_status_value(self, key):
|
def get_status_value(self, key):
|
||||||
|
|
Loading…
Add table
Reference in a new issue