From 76bddb1ec29f89e0141a4973937525bb21be797f Mon Sep 17 00:00:00 2001 From: ThomasV Date: Mon, 25 May 2020 16:35:29 +0200 Subject: [PATCH] swaps: handle cancellation in password dialog --- electrum/gui/qt/swap_dialog.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/electrum/gui/qt/swap_dialog.py b/electrum/gui/qt/swap_dialog.py index fc28e4245..dbafe263f 100644 --- a/electrum/gui/qt/swap_dialog.py +++ b/electrum/gui/qt/swap_dialog.py @@ -184,8 +184,11 @@ class SwapDialog(WindowModalDialog): if self.is_reverse: amount_sat = self.send_amount_e.get_amount() coro = self.swap_manager.reverse_swap(amount_sat) + asyncio.run_coroutine_threadsafe(coro, self.network.asyncio_loop) else: amount_sat = self.recv_amount_e.get_amount() - password = self.window.protect(lambda x: x, []) - coro = self.swap_manager.normal_swap(amount_sat, password) + self.window.protect(self.do_normal_swap, (amount_sat,)) + + def do_normal_swap(self, amount_sat, password): + coro = self.swap_manager.normal_swap(amount_sat, password) asyncio.run_coroutine_threadsafe(coro, self.network.asyncio_loop)