From 39bcdec584fd2ffa680e52612a7d2f26aca47a6a Mon Sep 17 00:00:00 2001 From: f321x Date: Fri, 18 Jul 2025 13:14:27 +0200 Subject: [PATCH] fix: handle UserCancelled in show_transaction `TxDialog` may has to fetch tx information from the network on construction (`self.set_tx()`) and is showing a `RunCoroutineDialog`. If the user cancels this dialog the `UserCancelled` exception is not caught in `show_transaction()` and can even lead to Electrum crashing. Fixes #10041 --- electrum/gui/qt/transaction_dialog.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py index 1e0bbe2cc..d8e708a95 100644 --- a/electrum/gui/qt/transaction_dialog.py +++ b/electrum/gui/qt/transaction_dialog.py @@ -47,7 +47,8 @@ from electrum.i18n import _ from electrum.plugin import run_hook from electrum.transaction import SerializationError, Transaction, PartialTransaction, TxOutpoint, TxinDataFetchProgress from electrum.logging import get_logger -from electrum.util import ShortID, get_asyncio_loop, UI_UNIT_NAME_TXSIZE_VBYTES, delta_time_str +from electrum.util import (ShortID, get_asyncio_loop, UI_UNIT_NAME_TXSIZE_VBYTES, delta_time_str, + UserCancelled) from electrum.network import Network from electrum.wallet import TxSighashRiskLevel, TxSighashDanger @@ -449,6 +450,8 @@ def show_transaction( except SerializationError as e: _logger.exception('unable to deserialize the transaction') parent.show_critical(_("Electrum was unable to deserialize the transaction:") + "\n" + str(e)) + except UserCancelled: + return else: d.show()