commit 680e9a55523885e96e08cbe49dd5ac55aac52da0
parent dd50259f68c3e35d8405e3cd059e93e27df5fb4e
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 8 Jul 2017 16:18:37 +0200
network: go back if cannot connect during catch_up
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/network.py b/lib/network.py
@@ -799,7 +799,7 @@ class Network(util.DaemonThread):
else:
interface.request = None
interface.mode = 'default'
- interface.print_error('catch up done')
+ interface.print_error('catch up done', interface.blockchain.height())
interface.blockchain.catch_up = None
self.notify('updated')
@@ -886,13 +886,14 @@ class Network(util.DaemonThread):
self.notify('updated')
next_height = height + 1 if height < interface.tip else None
else:
- next_height = None
+ # go back, reorg
+ next_height = height - 1
if next_height is None:
# exit catch_up state
interface.request = None
interface.mode = 'default'
- interface.print_error('catch up done', interface.blockchain.catch_up)
+ interface.print_error('catch up done', interface.blockchain.height())
interface.blockchain.catch_up = None
elif interface.mode == 'default':
@@ -1002,6 +1003,7 @@ class Network(util.DaemonThread):
self.request_header(interface, local_height)
else:
if not interface.blockchain.can_connect(header):
+ self.print_error("backward", height)
interface.mode = 'backward'
interface.bad = height
self.request_header(interface, height - 1)