Browse Source

interface.mark_ready: handle cancellation

3.3.3.1
SomberNight 6 years ago
parent
commit
2039c07a2d
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 9
      electrum/interface.py

9
electrum/interface.py

@ -252,16 +252,22 @@ class Interface(PrintError):
assert False
def mark_ready(self):
if self.ready.cancelled():
self.close()
raise asyncio.CancelledError()
if self.ready.done():
return
assert self.tip_header
chain = blockchain.check_header(self.tip_header)
if not chain:
self.blockchain = blockchain.blockchains[0]
else:
self.blockchain = chain
assert self.blockchain is not None
self.print_error("set blockchain with height", self.blockchain.height())
if not self.ready.done():
self.ready.set_result(1)
async def save_certificate(self):
@ -349,7 +355,6 @@ class Interface(PrintError):
self.tip = height
if self.tip < constants.net.max_checkpoint():
raise GracefulDisconnect('server tip below max checkpoint')
if not self.ready.done():
self.mark_ready()
async with self.network.bhi_lock:
if self.blockchain.height() < header['block_height']-1:

Loading…
Cancel
Save