Browse Source

network: go back if cannot connect during catch_up

2.9.x
ThomasV 7 years ago
parent
commit
680e9a5552
  1. 8
      lib/network.py

8
lib/network.py

@ -799,7 +799,7 @@ class Network(util.DaemonThread):
else: else:
interface.request = None interface.request = None
interface.mode = 'default' interface.mode = 'default'
interface.print_error('catch up done') interface.print_error('catch up done', interface.blockchain.height())
interface.blockchain.catch_up = None interface.blockchain.catch_up = None
self.notify('updated') self.notify('updated')
@ -886,13 +886,14 @@ class Network(util.DaemonThread):
self.notify('updated') self.notify('updated')
next_height = height + 1 if height < interface.tip else None next_height = height + 1 if height < interface.tip else None
else: else:
next_height = None # go back, reorg
next_height = height - 1
if next_height is None: if next_height is None:
# exit catch_up state # exit catch_up state
interface.request = None interface.request = None
interface.mode = 'default' 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 interface.blockchain.catch_up = None
elif interface.mode == 'default': elif interface.mode == 'default':
@ -1002,6 +1003,7 @@ class Network(util.DaemonThread):
self.request_header(interface, local_height) self.request_header(interface, local_height)
else: else:
if not interface.blockchain.can_connect(header): if not interface.blockchain.can_connect(header):
self.print_error("backward", height)
interface.mode = 'backward' interface.mode = 'backward'
interface.bad = height interface.bad = height
self.request_header(interface, height - 1) self.request_header(interface, height - 1)

Loading…
Cancel
Save