commit a89e67eeedd29bd1a33cc6b0b39af377f62674b6
parent 7a46bd10893b30779ba180442ab60495a416fd6c
Author: SomberNight <somber.night@protonmail.com>
Date: Sun, 4 Nov 2018 19:25:23 +0100
network: trivial clean-up
Diffstat:
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/electrum/daemon.py b/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()},
diff --git a/electrum/network.py b/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):