Skip to content

lianad: warn createrecovery to an address of the same wallet. - #2226

Draft
qlrd wants to merge 1 commit into
wizardsardine:masterfrom
qlrd:feat/warn-own-address-recovery
Draft

lianad: warn createrecovery to an address of the same wallet.#2226
qlrd wants to merge 1 commit into
wizardsardine:masterfrom
qlrd:feat/warn-own-address-recovery

Conversation

@qlrd

@qlrd qlrd commented Jul 29, 2026

Copy link
Copy Markdown

This commit adds a new error (code 1001, just after the existing 1000) bound to createrecovery -- as an error/warning response -- when a user wants to re-lock funds from/to addresses derived from the wallet descriptor.

As stated by jp1ac4 the starting point is to check this on the backend since the backend has easier access to known wallet addresses (needs a check on how to deal with derivation indices beyond what the DB knows).

The proposed flow is first return an error from createrecovery, controlled by a new Option<bool> parameter allow_own_address (defaults to false). With this, a user can try again with allow_own_address=true (see tests/test_rpc.py).

In that case, a new warnings field is added to the response alongside the psbt one, so the user can double-check the entire procedure.

refs #1654.

Details

A follow-up commit (the GUI confirmation flow) is being drafted while discussing.

Comment thread lianad/src/commands/mod.rs
coins_outpoints: &[bitcoin::OutPoint],
feerate_vb: u64,
timelock: Option<u16>,
allow_own_address: Option<bool>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can overlook something, but I dont think this flag is really useful, it seems to me we can just return warnings

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will get my annotations made before "that" and lyn :)

@qlrd qlrd Aug 9, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think i got your idea and make sense. LMK if it' correct: no need to allow_own_address option so the directed warnings value could go directly to GUI when doing it, and no need to call twice (one for "doing, deny and warning plus one for doing and warning" vs "one for doing and warning" ? My UI/UX thinking was to deny first, so the user could have full knowledge about will happen and need to be sure about before do. Your perspective is that the user already know the risks?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My perspective is we just want to warn the user, not prevent doing this, and making 2 call is overkill/overcpmplex imo

This commit adds a new error (code 1001, just after the existing 1000)
bound to `createrecovery` -- as an error/warning response -- when a user
wants to re-lock funds from/to addresses derived from the wallet
descriptor.

As stated by jp1ac4 the starting point is to check this on the backend
since the backend has easier access to known wallet addresses (needs a
check on how to deal with derivation indices beyond what the DB knows).

The proposed flow is first return an error from `createrecovery`,
controlled by a new `Option<bool>` parameter `allow_own_address`
(defaults to `false`). With this, a user can try again with
`allow_own_address=true` (see `tests/test_rpc.py`).

In that case, a new `warnings` field is added to the response alongside
the `psbt` one, so the user can double-check the entire procedure.

refs wizardsardine#1654.
@qlrd
qlrd force-pushed the feat/warn-own-address-recovery branch from 73ee1df to dde5488 Compare August 9, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants