From 1e25af7f0d5bef200c81c0737aae2e0b1afc52b4 Mon Sep 17 00:00:00 2001 From: shsmith Date: Sat, 4 Mar 2017 08:38:14 -0800 Subject: [PATCH 1/2] fix https://github.com/spesmilo/electrum/issues/2204 --- lib/network.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/network.py b/lib/network.py index 4fa6ee319..07d0d54f9 100644 --- a/lib/network.py +++ b/lib/network.py @@ -432,6 +432,8 @@ class Network(util.DaemonThread): self.print_error("stopping network") for interface in self.interfaces.values(): self.close_interface(interface) + if self.interface: + self.close_interface(self.interface) assert self.interface is None assert not self.interfaces self.connecting = set() @@ -669,7 +671,8 @@ class Network(util.DaemonThread): # Responses to connection attempts? while not self.socket_queue.empty(): server, socket = self.socket_queue.get() - self.connecting.remove(server) + if server in self.connecting: + self.connecting.remove(server) if socket: self.new_interface(server, socket) else: From 4109fd9eb2d2c88b1f9bf23ffb9b60ff9ee8efb8 Mon Sep 17 00:00:00 2001 From: shsmith Date: Sat, 4 Mar 2017 08:42:46 -0800 Subject: [PATCH 2/2] request fees, peers and banner before address subscriptions a wallet with many address subscriptions may time out on address subscriptions before fees are received because fees were requested last --- lib/network.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/network.py b/lib/network.py index 07d0d54f9..33eb043d8 100644 --- a/lib/network.py +++ b/lib/network.py @@ -325,14 +325,14 @@ class Network(util.DaemonThread): for request in requests: message_id = self.queue_request(request[0], request[1]) self.unanswered_requests[message_id] = request - for addr in self.subscribed_addresses: - self.queue_request('blockchain.address.subscribe', [addr]) self.queue_request('server.banner', []) self.queue_request('server.donation_address', []) self.queue_request('server.peers.subscribe', []) for i in bitcoin.FEE_TARGETS: self.queue_request('blockchain.estimatefee', [i]) self.queue_request('blockchain.relayfee', []) + for addr in self.subscribed_addresses: + self.queue_request('blockchain.address.subscribe', [addr]) def get_status_value(self, key): if key == 'status':