tcatch-up block headers from a single interface at a time - electrum - Electrum Bitcoin wallet (HTM) git clone https://git.parazyd.org/electrum (DIR) Log (DIR) Files (DIR) Refs (DIR) Submodules --- (DIR) commit ac77c9b9bdb9a3618a0febd98cc72bece9eb7c25 (DIR) parent 82c9430e7a99d0e1c88de24454595931337f1ad7 (HTM) Author: ThomasV <thomasv@electrum.org> Date: Fri, 19 May 2017 12:16:21 +0200 catch-up block headers from a single interface at a time Diffstat: M lib/network.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- (DIR) diff --git a/lib/network.py b/lib/network.py t@@ -221,6 +221,7 @@ class Network(util.DaemonThread): self.debug = False self.irc_servers = {} # returned by interface (list from irc) self.recent_servers = self.read_recent_servers() + self.catch_up = None # interface catching up self.banner = '' self.donation_address = '' t@@ -687,6 +688,8 @@ class Network(util.DaemonThread): self.close_interface(self.interfaces[server]) self.headers.pop(server, None) self.notify('interfaces') + if server == self.catch_up: + self.catch_up = None def new_interface(self, server, socket): self.add_recent_server(server) t@@ -851,6 +854,7 @@ class Network(util.DaemonThread): self.request_header(interface, next_height) else: interface.request = None + self.catch_up = None def maintain_requests(self): for interface in self.interfaces.values(): t@@ -905,7 +909,8 @@ class Network(util.DaemonThread): self.blockchain.save_header(header) self.notify('updated') # otherwise trigger a search - elif i.request is None: + elif self.catch_up is None: + self.catch_up = i.server self.on_header(i, header) if i == self.interface: