tinterface: fix only-genesis regtest case - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 0ddccd56c70a5629618065c30526dcc38b9cdc90 DIR parent 5b9b6a931d0a05629511dd743a5ff326e80261ca HTML Author: SomberNight <somber.night@protonmail.com> Date: Mon, 10 Dec 2018 17:46:37 +0100 interface: fix only-genesis regtest case Diffstat: M electrum/interface.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- DIR diff --git a/electrum/interface.py b/electrum/interface.py t@@ -438,14 +438,17 @@ class Interface(PrintError): return last, height async def step(self, height, header=None): - assert height != 0 - assert height <= self.tip, (height, self.tip) + assert 0 <= height <= self.tip, (height, self.tip) if header is None: header = await self.get_block_header(height, 'catchup') chain = blockchain.check_header(header) if 'mock' not in header else header['mock']['check'](header) if chain: self.blockchain = chain if isinstance(chain, Blockchain) else self.blockchain + # note: there is an edge case here that is not handled. + # we might know the blockhash (enough for check_header) but + # not have the header itself. e.g. regtest chain with only genesis. + # this situation resolves itself on the next block return 'catchup', height+1 can_connect = blockchain.can_connect(header) if 'mock' not in header else header['mock']['connect'](height)