tdaemon: fix long-standing bug in status request - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit f91f03b3d44c8e22931e1989e51b2489093940d3 DIR parent ec24087b5a7a010f7c098378983e949cf4c1177d HTML Author: Neil Booth <kyuupichan@gmail.com> Date: Sun, 31 Jan 2016 11:50:44 +0900 daemon: fix long-standing bug in status request Gracefully handle a status request when self.network is None Diffstat: M lib/daemon.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) --- DIR diff --git a/lib/daemon.py b/lib/daemon.py t@@ -100,17 +100,21 @@ class Daemon(DaemonThread): if sub == 'start': response = "Daemon already running" elif sub == 'status': - p = self.network.get_parameters() - response = { - 'path': self.network.config.path, - 'server': p[0], - 'blockchain_height': self.network.get_local_height(), - 'server_height': self.network.get_server_height(), - 'nodes': self.network.get_interfaces(), - 'connected': self.network.is_connected(), - 'auto_connect': p[4], - 'wallets': dict([ (k, w.is_up_to_date()) for k, w in self.wallets.items()]), - } + if self.network: + p = self.network.get_parameters() + response = { + 'path': self.network.config.path, + 'server': p[0], + 'blockchain_height': self.network.get_local_height(), + 'server_height': self.network.get_server_height(), + 'nodes': self.network.get_interfaces(), + 'connected': self.network.is_connected(), + 'auto_connect': p[4], + 'wallets': {k: w.is_up_to_date() + for k, w in self.wallets.items()}, + } + else: + response = "Daemon offline" elif sub == 'stop': self.stop() response = "Daemon stopped"