Browse Source

network: trivial clean-up

3.3.3.1
SomberNight 6 years ago
parent
commit
a89e67eeed
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 6
      electrum/daemon.py
  2. 12
      electrum/network.py

6
electrum/daemon.py

@ -194,18 +194,18 @@ class Daemon(DaemonThread):
response = False
elif sub == 'status':
if self.network:
p = self.network.get_parameters()
net_params = self.network.get_parameters()
current_wallet = self.cmd_runner.wallet
current_wallet_path = current_wallet.storage.path \
if current_wallet else None
response = {
'path': self.network.config.path,
'server': p[0],
'server': net_params.host,
'blockchain_height': self.network.get_local_height(),
'server_height': self.network.get_server_height(),
'spv_nodes': len(self.network.get_interfaces()),
'connected': self.network.is_connected(),
'auto_connect': p[4],
'auto_connect': net_params.auto_connect,
'version': ELECTRUM_VERSION,
'wallets': {k: w.is_up_to_date()
for k, w in self.wallets.items()},

12
electrum/network.py

@ -299,7 +299,7 @@ class Network(PrintError):
lh = self.get_local_height()
result = (lh - sh) > 1
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
def _set_status(self, status):
@ -350,13 +350,15 @@ class Network(PrintError):
for i in FEE_ETA_TARGETS:
fee_tasks.append((i, await group.spawn(session.send_request('blockchain.estimatefee', [i]))))
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')
for i, task in fee_tasks:
fee_estimates_eta = {}
for nblock_target, task in fee_tasks:
fee = int(task.result() * COIN)
self.print_error("fee_estimates[%d]" % i, fee)
fee_estimates_eta[nblock_target] = fee
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')
def get_status_value(self, key):

Loading…
Cancel
Save