interface: if header is on other chain already, just switch (regression)

This commit is contained in:
SomberNight 2018-09-16 07:42:25 +02:00
parent 3fc9326c43
commit 27e42b4826
No known key found for this signature in database
GPG key ID: B33B5F232C6271E9

View file

@ -423,10 +423,13 @@ class Interface(PrintError):
assert height <= self.tip, (height, self.tip)
if header is None:
header = await self.get_block_header(height, 'catchup')
chain = self.blockchain.check_header(header) if 'mock' not in header else header['mock']['check'](header)
if chain: return 'catchup', height+1
can_connect = blockchain.can_connect(header) if 'mock' not in header else header['mock']['connect'](height)
chain = blockchain.check_header(header) if 'mock' not in header else header['mock']['check'](header)
if chain:
self.blockchain = chain
return 'catchup', height+1
can_connect = blockchain.can_connect(header) if 'mock' not in header else header['mock']['connect'](height)
if not can_connect:
self.print_error("can't connect", height)
height, header, bad, bad_header = await self._search_headers_backwards(height, header)