1
0

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
This commit is contained in:
f321x
2025-07-18 13:14:27 +02:00
parent 23adf13070
commit 39bcdec584

View File

@@ -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()