From f7c1b203b2b088f9b0b1db279959ca5a44b40aa5 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Tue, 25 Mar 2025 11:48:24 +0100 Subject: [PATCH] qt: handle UserCancelled when initializing swapmanager and requesting swap invoice when sending change to lightning --- electrum/gui/qt/main_window.py | 2 ++ electrum/gui/qt/send_tab.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 4584be42c..f51da149d 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -1228,6 +1228,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener): return try: self.run_coroutine_dialog(wait_until_initialized(), _('Please wait...')) + except UserCancelled: + return False except Exception as e: self.show_error(str(e)) return False diff --git a/electrum/gui/qt/send_tab.py b/electrum/gui/qt/send_tab.py index 461993fc5..69befa66d 100644 --- a/electrum/gui/qt/send_tab.py +++ b/electrum/gui/qt/send_tab.py @@ -345,6 +345,8 @@ class SendTab(QWidget, MessageBoxMixin, Logger): except SwapServerError as e: self.show_error(str(e)) return + except UserCancelled: + return tx.replace_output_address(DummyAddress.SWAP, swap.lockup_address) assert tx.get_dummy_output(DummyAddress.SWAP) is None tx.swap_invoice = invoice