From 2ee41975f9efba4ef6b6bbe00a07654aaec3fce6 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sat, 14 Jul 2018 18:42:11 +0200 Subject: [PATCH] add lnworker.main_loop to network.futures so it gets cancelled on exit. fix aiosafe verbosity. --- electrum/lnbase.py | 2 +- electrum/lnworker.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/electrum/lnbase.py b/electrum/lnbase.py index 4c2638934..188f300f2 100644 --- a/electrum/lnbase.py +++ b/electrum/lnbase.py @@ -275,7 +275,7 @@ def aiosafe(f): try: return await f(*args, **kwargs) except BaseException as e: - self.print_msg("Exception in", f.__name__, ":", e.__class__.__name__, str(e)) + self.print_error("Exception in", f.__name__, ":", e.__class__.__name__, str(e)) self.exception = e return f2 diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 5cdb30cb7..efe1227f8 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -46,7 +46,7 @@ class LNWorker(PrintError): # wait until we see confirmations self.network.register_callback(self.on_network_update, ['updated', 'verified']) # thread safe self.on_network_update('updated') # shortcut (don't block) if funding tx locked and verified - asyncio.run_coroutine_threadsafe(self.main_loop(), asyncio.get_event_loop()) + self.network.futures.append(asyncio.run_coroutine_threadsafe(self.main_loop(), asyncio.get_event_loop())) def channels_for_peer(self, node_id): assert type(node_id) is bytes