network: call switch_lagging after catch up

This commit is contained in:
ThomasV 2017-07-19 18:32:48 +02:00
parent b243772d68
commit 1457a869d3
1 changed files with 4 additions and 3 deletions

View File

@ -487,6 +487,7 @@ class Network(util.DaemonThread):
self.switch_to_interface(server)
else:
self.switch_lagging_interface()
self.notify('updated')
def switch_to_random_interface(self):
'''Switch to a random connected server other than the current one'''
@ -505,7 +506,6 @@ class Network(util.DaemonThread):
if filtered:
choice = random.choice(filtered)
self.switch_to_interface(choice)
self.notify('updated')
def switch_to_interface(self, server):
'''Switch to server as our interface. If no connection exists nor
@ -879,6 +879,7 @@ class Network(util.DaemonThread):
# exit catch_up state
interface.print_error('catch up done', interface.blockchain.height())
interface.blockchain.catch_up = None
self.switch_lagging_interface()
self.notify('updated')
elif interface.mode == 'default':
@ -979,16 +980,16 @@ class Network(util.DaemonThread):
b = blockchain.check_header(header)
if b:
interface.blockchain = b
self.notify('interfaces')
self.switch_lagging_interface()
self.notify('interfaces')
return
b = blockchain.can_connect(header)
if b:
interface.blockchain = b
b.save_header(header)
self.switch_lagging_interface()
self.notify('updated')
self.notify('interfaces')
self.switch_lagging_interface()
return
tip = max([x.height() for x in self.blockchains.values()])
if tip >=0: