From dc417a4f9996442b878b2195ff00e58783724dd4 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Mon, 20 Oct 2025 12:15:44 +0200 Subject: [PATCH] timelock_recovery: recovery destination checks for address is_mine or script output note: validation in frontend should be added to backend code as well --- electrum/plugins/timelock_recovery/qt.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/electrum/plugins/timelock_recovery/qt.py b/electrum/plugins/timelock_recovery/qt.py index 26c38d492..6c0d0a772 100644 --- a/electrum/plugins/timelock_recovery/qt.py +++ b/electrum/plugins/timelock_recovery/qt.py @@ -463,6 +463,16 @@ class Plugin(TimelockRecoveryPlugin): payto_e.setStyleSheet(ColorScheme.RED.as_stylesheet(True)) payto_e.setToolTip("At least one line must be set to max spend ('!' in the amount column).") return False + for output in pi.multiline_outputs: # type: PartialTxOutput + if not output.address: + payto_e.setStyleSheet(ColorScheme.RED.as_stylesheet(True)) + payto_e.setToolTip("Recovery should only send to addresses.") + return False + else: + if context.wallet.is_mine(output.address): + payto_e.setStyleSheet(ColorScheme.RED.as_stylesheet(True)) + payto_e.setToolTip("Recovery should not send to same wallet.") + return False context.outputs = pi.multiline_outputs else: if not pi.is_available() or pi.type != PaymentIdentifierType.SPK or not pi.spk_is_address: @@ -470,6 +480,10 @@ class Plugin(TimelockRecoveryPlugin): payto_e.setToolTip("Invalid address type - must be a Bitcoin address.") return False assert pi.spk and pi.spk_is_address + if context.wallet.is_mine(pi.text): + payto_e.setStyleSheet(ColorScheme.RED.as_stylesheet(True)) + payto_e.setToolTip("Recovery should not send to same wallet.") + return False context.outputs = [PartialTxOutput(scriptpubkey=pi.spk, value='!')] return True