Merge pull request #10272 from accumulator/timelock_recovery_destination_validation
timelock_recovery: recovery destination checks for address is_mine or script output
This commit is contained in:
@@ -463,6 +463,16 @@ class Plugin(TimelockRecoveryPlugin):
|
|||||||
payto_e.setStyleSheet(ColorScheme.RED.as_stylesheet(True))
|
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).")
|
payto_e.setToolTip("At least one line must be set to max spend ('!' in the amount column).")
|
||||||
return False
|
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
|
context.outputs = pi.multiline_outputs
|
||||||
else:
|
else:
|
||||||
if not pi.is_available() or pi.type != PaymentIdentifierType.SPK or not pi.spk_is_address:
|
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.")
|
payto_e.setToolTip("Invalid address type - must be a Bitcoin address.")
|
||||||
return False
|
return False
|
||||||
assert pi.spk and pi.spk_is_address
|
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='!')]
|
context.outputs = [PartialTxOutput(scriptpubkey=pi.spk, value='!')]
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user