From d1a15ae8f6b6d30f74b091f29c2132cb72dcc5a4 Mon Sep 17 00:00:00 2001 From: Oren Date: Sat, 24 May 2025 01:54:51 +0300 Subject: [PATCH] throw exception if signing is not complete There could be flows where sign_transaction will return without actually signing the transaction. We also want to add the ability to sign the transactions externally, so here we check if they are already signed. --- electrum/plugins/timelock_recovery/qt.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/electrum/plugins/timelock_recovery/qt.py b/electrum/plugins/timelock_recovery/qt.py index 7e646c2c7..5c1e2976e 100644 --- a/electrum/plugins/timelock_recovery/qt.py +++ b/electrum/plugins/timelock_recovery/qt.py @@ -414,11 +414,20 @@ class Plugin(TimelockRecoveryPlugin): password = main_window.get_password() def task(): - wallet.sign_transaction(context.alert_tx, password, ignore_warnings=True) + if not context.alert_tx.is_complete(): + wallet.sign_transaction(context.alert_tx, password, ignore_warnings=True) + if not context.alert_tx.is_complete(): + raise Exception(_("Alert transaction signing was not completed")) context.add_input_info() - wallet.sign_transaction(context.recovery_tx, password, ignore_warnings=True) + if not context.recovery_tx.is_complete(): + wallet.sign_transaction(context.recovery_tx, password, ignore_warnings=True) + if not context.recovery_tx.is_complete(): + raise Exception(_("Recovery transaction signing was not completed")) if context.cancellation_tx is not None: - wallet.sign_transaction(context.cancellation_tx, password, ignore_warnings=True) + if not context.cancellation_tx.is_complete(): + wallet.sign_transaction(context.cancellation_tx, password, ignore_warnings=True) + if not context.cancellation_tx.is_complete(): + raise Exception(_("Cancellation transaction signing was not completed")) def on_success(result): self.create_download_dialog(context)