Browse Source

fix prev: rm incorrect assert

master
SomberNight 7 years ago
parent
commit
6f5a4a5502
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
  1. 7
      electrum/interface.py

7
electrum/interface.py

@ -374,8 +374,7 @@ class Interface(PrintError):
# another interface amended the blockchain # another interface amended the blockchain
self.print_error("skipping header", height) self.print_error("skipping header", height)
continue continue
if self.tip < height: height = min(height, self.tip)
height = self.tip
_, height = await self.step(height, header) _, height = await self.step(height, header)
async def sync_until(self, height, next_height=None): async def sync_until(self, height, next_height=None):
@ -417,7 +416,6 @@ class Interface(PrintError):
if can_connect: if can_connect:
self.print_error("could connect", height) self.print_error("could connect", height)
height += 1 height += 1
assert height <= self.tip, (height, self.tip)
if isinstance(can_connect, Blockchain): # not when mocking if isinstance(can_connect, Blockchain): # not when mocking
self.blockchain = can_connect self.blockchain = can_connect
self.blockchain.save_header(header) self.blockchain.save_header(header)
@ -469,15 +467,14 @@ class Interface(PrintError):
height = bad height = bad
header = await self.get_block_header(height, 'binary') header = await self.get_block_header(height, 'binary')
else: else:
height = bad + 1
if ismocking: if ismocking:
height = bad + 1
self.print_error("TODO replace blockchain") self.print_error("TODO replace blockchain")
return 'conflict', height return 'conflict', height
self.print_error('forkpoint conflicts with existing fork', branch.path()) self.print_error('forkpoint conflicts with existing fork', branch.path())
branch.write(b'', 0) branch.write(b'', 0)
branch.save_header(bad_header) branch.save_header(bad_header)
self.blockchain = branch self.blockchain = branch
height = bad + 1
return 'conflict', height return 'conflict', height
else: else:
bh = self.blockchain.height() bh = self.blockchain.height()

Loading…
Cancel
Save