tauto-cycle: switch to the longest chain - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit c18a49b8fe3bcf5eb71fd4ea98243fbf7a000bcb DIR parent 1be0ea1494c505fcffd58c88230769ba9c4d4167 HTML Author: ThomasV <thomasv@gitorious> Date: Thu, 3 Oct 2013 14:56:48 +0200 auto-cycle: switch to the longest chain Diffstat: M lib/blockchain.py | 9 ++++++--- M lib/interface.py | 5 ++--- 2 files changed, 8 insertions(+), 6 deletions(-) --- DIR diff --git a/lib/blockchain.py b/lib/blockchain.py t@@ -94,9 +94,12 @@ class Blockchain(threading.Thread): self.network.trigger_callback('updated') h = self.servers_height.get(self.network.interface.server) - if h is not None and h < height - 1: - print "server is lagging", height, h - self.network.interface.stop() + if h is not None and h < height : + print_error( "Server is lagging", height, h) + if self.config.get('auto_cycle'): + self.network.set_server(i.server) + else: + self.network.interface.stop() DIR diff --git a/lib/interface.py b/lib/interface.py t@@ -109,8 +109,8 @@ class Interface(threading.Thread): self.pending_transactions_for_notifications= [] # parse server - s = config.get('server') - host, port, protocol = s.split(':') + self.server = config.get('server') + host, port, protocol = self.server.split(':') port = int(port) if protocol not in 'ghst': t@@ -123,7 +123,6 @@ class Interface(threading.Thread): self.proxy = self.parse_proxy_options(config.get('proxy')) if self.proxy: self.proxy_mode = proxy_modes.index(self.proxy["mode"]) + 1 - self.server = host + ':%d:%s'%(port, protocol)