network: minor fix

This commit is contained in:
ThomasV 2017-07-13 09:31:27 +02:00
parent 96a685a765
commit e6116db565
1 changed files with 6 additions and 6 deletions

View File

@ -835,7 +835,6 @@ class Network(util.DaemonThread):
if b:
interface.mode = 'default'
interface.blockchain = b
#interface.print_error('passed checkpoint', b.filename)
self.queue_request('blockchain.headers.subscribe', [], interface)
else:
interface.print_error("checkpoint failed")
@ -850,12 +849,13 @@ class Network(util.DaemonThread):
interface.print_error("binary search")
next_height = (interface.bad + interface.good) // 2
else:
interface.bad = height
delta = interface.tip - height
next_height = interface.tip - 2 * delta
if next_height < 0:
interface.print_error("header didn't connect, dismissing interface")
if height == 0:
self.connection_down(interface.server)
next_height = None
else:
interface.bad = height
delta = interface.tip - height
next_height = max(0, interface.tip - 2 * delta)
elif interface.mode == 'binary':
if can_connect:
interface.good = height