Browse Source

network: minor fix

master
ThomasV 9 years ago
parent
commit
e6116db565
  1. 10
      lib/network.py

10
lib/network.py

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

Loading…
Cancel
Save