commit 6f5a4a55026b070e0a6aa6cb31da2fa72e9134bd
parent 482259df8b0f9efff8dbc338618c60829275d3c5
Author: SomberNight <somber.night@protonmail.com>
Date: Sat, 15 Sep 2018 08:23:49 +0200
fix prev: rm incorrect assert
Diffstat:
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/electrum/interface.py b/electrum/interface.py
@@ -374,8 +374,7 @@ class Interface(PrintError):
# another interface amended the blockchain
self.print_error("skipping header", height)
continue
- if self.tip < height:
- height = self.tip
+ height = min(height, self.tip)
_, height = await self.step(height, header)
async def sync_until(self, height, next_height=None):
@@ -417,7 +416,6 @@ class Interface(PrintError):
if can_connect:
self.print_error("could connect", height)
height += 1
- assert height <= self.tip, (height, self.tip)
if isinstance(can_connect, Blockchain): # not when mocking
self.blockchain = can_connect
self.blockchain.save_header(header)
@@ -469,15 +467,14 @@ class Interface(PrintError):
height = bad
header = await self.get_block_header(height, 'binary')
else:
+ height = bad + 1
if ismocking:
- height = bad + 1
self.print_error("TODO replace blockchain")
return 'conflict', height
self.print_error('forkpoint conflicts with existing fork', branch.path())
branch.write(b'', 0)
branch.save_header(bad_header)
self.blockchain = branch
- height = bad + 1
return 'conflict', height
else:
bh = self.blockchain.height()