Wallet import descriptors #1144

Open
uqlidi wants to merge 7 commits from wallet-import-descriptors into qt6 AGit
uqlidi commented 2026-11-18 21:35:31 +00:00 (Migrated from github.com)

Fixes #1058.

View-only import used to take only a plain xpub, always imported it as native SegWit, and never rescanned. Now it accepts:

  • listdescriptors output
  • descriptors, one per line
  • [fingerprint/path]xpub
  • ypub/zpub
  • a plain xpub (asks for the address type)

The import uses importDescriptors, so it rescans from the birth time. When the input has no timestamps, the form asks when the wallet was created. Private keys and multisig are rejected.

listdescriptors Descriptor lines Plain xpub
02-listdescriptors 04-descriptor-lines 07-plain-xpub
Rejected line Private key Importing
08-rejected-multisig-line 09-rejected-private-key 11-importing
More states
Empty Inactive descriptor and older date Key with origin path
01-empty 03-listdescriptors-inactive-and-older 05-key-with-origin
vpub Other network Done
06-slip132-vpub 10-rejected-other-network 12-ready
Fixes #1058. View-only import used to take only a plain xpub, always imported it as native SegWit, and never rescanned. Now it accepts: - `listdescriptors` output - descriptors, one per line - `[fingerprint/path]xpub` - `ypub`/`zpub` - a plain `xpub` (asks for the address type) The import uses `importDescriptors`, so it rescans from the birth time. When the input has no timestamps, the form asks when the wallet was created. Private keys and multisig are rejected. | `listdescriptors` | Descriptor lines | Plain xpub | |---|---|---| | <img width="400" alt="02-listdescriptors" src="https://git.fish.foo/attachments/6926c026-4385-4f19-8329-f0675709ba3e" /> | <img width="400" alt="04-descriptor-lines" src="https://git.fish.foo/attachments/bf3a293f-ae49-4d24-ac6b-9711f0296713" /> | <img width="400" alt="07-plain-xpub" src="https://git.fish.foo/attachments/2444f0d0-83d7-4aba-858a-34b93e67998a" /> | | Rejected line | Private key | Importing | |---|---|---| | <img width="400" alt="08-rejected-multisig-line" src="https://git.fish.foo/attachments/e12ff258-3ac3-43cc-9827-a3adb6cdcee3" /> | <img width="400" alt="09-rejected-private-key" src="https://git.fish.foo/attachments/cb64a12b-2e33-4643-9aa8-c7428148074d" /> | <img width="400" alt="11-importing" src="https://git.fish.foo/attachments/5bf7efa8-29e4-4326-a72d-0a1c42d91cbf" /> | <details> <summary>More states</summary> | Empty | Inactive descriptor and older date | Key with origin path | |---|---|---| | <img width="400" alt="01-empty" src="https://git.fish.foo/attachments/b5719416-a1e3-4bd7-bbd9-1954bdc3ee4c" /> | <img width="400" alt="03-listdescriptors-inactive-and-older" src="https://git.fish.foo/attachments/c393babf-3a1c-4d5d-9f60-c58821830c9f" /> | <img width="400" alt="05-key-with-origin" src="https://git.fish.foo/attachments/6e1ef942-f316-4b9d-92cc-fdb10868d548" /> | | `vpub` | Other network | Done | |---|---|---| | <img width="400" alt="06-slip132-vpub" src="https://git.fish.foo/attachments/9873247e-6930-428d-8e8c-e3d1de9de043" /> | <img width="400" alt="10-rejected-other-network" src="https://git.fish.foo/attachments/bd11cfbd-d3ef-4b40-82fd-3009e914682f" /> | <img width="400" alt="12-ready" src="https://git.fish.foo/attachments/d9f231d4-7db5-44d2-80c5-0ccee0675b59" /> | </details>
pinheadmz commented 2026-11-18 21:49:41 +00:00 (Migrated from github.com)

You'll need to add a PR description or this will be closed.

You'll need to add a PR description or this will be closed.
rreview commented 2026-11-18 22:55:39 +00:00 (Migrated from github.com)

6 additional verified findings in the Review report.

🟠 Minor · Terminal import-recovery states leave GUI backups blocked

An incomplete installation cannot finish through recovery, and a repeatedly failing rescan keeps the same backup block, although the error tells users to back up once the import finishes.

Location: qml/models/walletqmlmodel.cpp:1089 (head).

🟠 Minor · Reopening during cancelled recovery loses the replacement model's recovery state

Reopening a wallet before its cancelled recovery job retires leaves the replacement model without a history warning, retry action or backup guard until another reload.

Location: qml/walletqmlcontroller.cpp:574 (head).

🟠 Minor · Import exceptions bypass wallet and recovery-marker cleanup

A storage exception during descriptor setup now leaves a recovery marker behind; leaking the loaded wallet on exceptions was pre-existing, and no common production trigger was identified.

Location: qml/walletqmlcontroller.cpp:762 (head).

🟠 Minor · Failed import cleanup reports deletion without checking removal errors

If database-file removal fails, cleanup clears the recovery marker and reports the cancelled wallet deleted even though it remains on disk; production occurrence is unconfirmed.

Location: qml/walletqmlcontroller.cpp:122 (head).

🟠 Minor · Change-only imports pass the address-generation check but cannot receive

An active internal-only descriptor passes either parser, but the resulting wallet has no receive address types and Receive offers an ineffective retry.

Location: qml/viewonlyimport.cpp:292 (head).

🟠 Minor · Duplicate range errors are detected only after the import rescans

Repeated descriptors with non-containing ranges can trigger a full rescan before the failed import is deleted; no current producer of this JSON was identified.

Location: qml/viewonlyimport.cpp:243 (head).

Review coverage was incomplete.


Reviewed: 46324d90762c · Review report

<!-- ralph-major:bitcoin-core/gui-qml --> [6 additional verified findings in the Review report](<https://review.fish.foo/report/gui/1144-46324d90762c97b30dfdb35e944c7b2b1955ec4b-3155-6.html>). **🟠 Minor · Terminal import-recovery states leave GUI backups blocked** An `incomplete` installation cannot finish through recovery, and a repeatedly failing rescan keeps the same backup block, although the error tells users to back up once the import finishes. Location: [qml/models/walletqmlmodel.cpp:1089](<https://github.com/bitcoin-core/gui-qml/blob/46324d90762c97b30dfdb35e944c7b2b1955ec4b/qml/models/walletqmlmodel.cpp#L1089>) (head). **🟠 Minor · Reopening during cancelled recovery loses the replacement model's recovery state** Reopening a wallet before its cancelled recovery job retires leaves the replacement model without a history warning, retry action or backup guard until another reload. Location: [qml/walletqmlcontroller.cpp:574](<https://github.com/bitcoin-core/gui-qml/blob/46324d90762c97b30dfdb35e944c7b2b1955ec4b/qml/walletqmlcontroller.cpp#L574>) (head). **🟠 Minor · Import exceptions bypass wallet and recovery-marker cleanup** A storage exception during descriptor setup now leaves a recovery marker behind; leaking the loaded wallet on exceptions was pre-existing, and no common production trigger was identified. Location: [qml/walletqmlcontroller.cpp:762](<https://github.com/bitcoin-core/gui-qml/blob/46324d90762c97b30dfdb35e944c7b2b1955ec4b/qml/walletqmlcontroller.cpp#L762>) (head). **🟠 Minor · Failed import cleanup reports deletion without checking removal errors** If database-file removal fails, cleanup clears the recovery marker and reports the cancelled wallet deleted even though it remains on disk; production occurrence is unconfirmed. Location: [qml/walletqmlcontroller.cpp:122](<https://github.com/bitcoin-core/gui-qml/blob/46324d90762c97b30dfdb35e944c7b2b1955ec4b/qml/walletqmlcontroller.cpp#L122>) (head). **🟠 Minor · Change-only imports pass the address-generation check but cannot receive** An active internal-only descriptor passes either parser, but the resulting wallet has no receive address types and Receive offers an ineffective retry. Location: [qml/viewonlyimport.cpp:292](<https://github.com/bitcoin-core/gui-qml/blob/46324d90762c97b30dfdb35e944c7b2b1955ec4b/qml/viewonlyimport.cpp#L292>) (head). **🟠 Minor · Duplicate range errors are detected only after the import rescans** Repeated descriptors with non-containing ranges can trigger a full rescan before the failed import is deleted; no current producer of this JSON was identified. Location: [qml/viewonlyimport.cpp:243](<https://github.com/bitcoin-core/gui-qml/blob/46324d90762c97b30dfdb35e944c7b2b1955ec4b/qml/viewonlyimport.cpp#L243>) (head). Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`46324d90762c`](<https://github.com/bitcoin-core/gui-qml/commit/46324d90762c97b30dfdb35e944c7b2b1955ec4b>) · [Review report](<https://review.fish.foo/report/gui/1144-46324d90762c97b30dfdb35e944c7b2b1955ec4b-3155-6.html>)
Sign in to join this conversation.
No description provided.