fix: server lag
authorThomasV <thomasv@gitorious>
Sat, 5 Oct 2013 09:02:17 +0000 (11:02 +0200)
committerThomasV <thomasv@gitorious>
Sat, 5 Oct 2013 09:02:17 +0000 (11:02 +0200)
lib/network.py

index 2112778..bb0d147 100644 (file)
@@ -199,7 +199,9 @@ class Network(threading.Thread):
     def switch_to_interface(self, interface):
         print_error("switching to", interface.server)
         self.interface = interface
-        self.server_lag = self.blockchain.height - self.heights[self.interface.server]
+        h =  self.heights.get(self.interface.server)
+        if h:
+            self.server_lag = self.blockchain.height - h
         self.config.set_key('server', self.interface.server, False)
         self.send_subscriptions()
         self.trigger_callback('connected')