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:
@@ -47,7 +47,8 @@ from electrum.i18n import _
|
|||||||
from electrum.plugin import run_hook
|
from electrum.plugin import run_hook
|
||||||
from electrum.transaction import SerializationError, Transaction, PartialTransaction, TxOutpoint, TxinDataFetchProgress
|
from electrum.transaction import SerializationError, Transaction, PartialTransaction, TxOutpoint, TxinDataFetchProgress
|
||||||
from electrum.logging import get_logger
|
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.network import Network
|
||||||
from electrum.wallet import TxSighashRiskLevel, TxSighashDanger
|
from electrum.wallet import TxSighashRiskLevel, TxSighashDanger
|
||||||
|
|
||||||
@@ -449,6 +450,8 @@ def show_transaction(
|
|||||||
except SerializationError as e:
|
except SerializationError as e:
|
||||||
_logger.exception('unable to deserialize the transaction')
|
_logger.exception('unable to deserialize the transaction')
|
||||||
parent.show_critical(_("Electrum was unable to deserialize the transaction:") + "\n" + str(e))
|
parent.show_critical(_("Electrum was unable to deserialize the transaction:") + "\n" + str(e))
|
||||||
|
except UserCancelled:
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
d.show()
|
d.show()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user