Review report

bitcoin-core/gui-qml: PR #1057

1 major finding · 4 minor findings

Findings

Link

[major] · The complete-wallet export omits pre-encryption addresses

Setting a password on an existing wallet rotates its active descriptors, so the advertised complete export omits pre-encryption addresses and cannot monitor their funds or subsequent payments.

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

Details and suggested fix

watchOnlyExports() visits only the active receive/change managers returned by GetScriptPubKeyMan(type, internal). For an ordinary nonblank private-key wallet, the settings page's Set password action reaches CWallet::EncryptWallet(), which generates descriptors from a fresh seed and replaces every active mapping. The old managers remain in GetAllScriptPubKeyMans(), but this export never visits them. Thus, issuing an address before encryption and exporting afterwards produces a monitoring copy that misses payments to that address, despite the modal's “Complete watch-only wallet” description. The source wallet retains its keys and spending ability. Enumerate all managers, include publicly derivable inactive descriptors, and explicitly report unsupported omissions instead of presenting the active subset as complete. Add a regression test that issues an address before encryption and verifies that the export still covers it afterwards.


Link

[minor] · Extended-key export silently omits incompatible derivation layouts

For nonstandard imported layouts, the unrestricted extended-key option can produce a watch-only copy that misses receive or change addresses.

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

Details and suggested fix

extendedKey always contains only receive->xpub, although the parser accepts empty and multi-step branch suffixes and the descriptor fallback supports a separately keyed change chain. The added C++ fixture already installs legacy receive and change keys under different purposes, 44h and 45h. Exporting its receive key cannot represent that change key. Likewise, an importer deriving the conventional /0/i and /1/i paths watches different addresses when the source uses other suffixes. The modal still offers Extended key, hides the Chains row, and gives no compatibility warning. Gate this option on receive /0 and either absent change or matching script/origin/xpub on /1; direct incompatible layouts to descriptors instead. No current GUI wallet-creation path producing these layouts was identified, so production occurrence remains unconfirmed.


Link

[minor] · Wallet changes during opening leave the previous export visible

A wallet change during the 180 ms enter transition bypasses invalidation, leaving the previous wallet's descriptors available while save naming uses the newly selected wallet.

Location: qml/components/WatchOnlyExportModal.qml:111 (head).

Details and suggested fix

openForWallet() snapshots exports before calling open(), but onWalletChanged closes the popup only when opened is true. Qt keeps that property false until the enter transition finishes. If an asynchronous selection change, such as queued wallet-unload handling, arrives during this interval, nothing clears the snapshot or checks its wallet afterwards. The popup therefore finishes opening with wallet A's QR and copy payload, while openSaveDialog() can name the file for wallet B. Store the export session's wallet before opening and invalidate the session on any identity mismatch, including during entry. Add a test that changes wallets immediately after openForWallet(); the existing helper waits until the popup is fully opened before switching.


Link

[minor] · Export availability stays stale after descriptor changes

Importing supported active descriptors into the selected blank watch-only wallet leaves the export action hidden until wallet reselection refreshes the binding.

Location: qml/pages/settings/WalletSectionPage.qml:24 (head).

Details and suggested fix

canExportWatchOnly calls a plain Q_INVOKABLE inside a binding whose observable dependencies are only wallet identity and load state. Core emits NotifyCanGetAddressesChanged() when active managers change, but WalletQmlModel does not forward that notification, and ordinary settings navigation reuses the cached page. An RPC or console import with active:true can therefore make the wallet exportable without revealing the row. Conversely, removing its supported active descriptors leaves a visible action whose openForWallet() silently returns false. Expose a notifying availability property refreshed through a queued handleCanGetAddressesChanged subscription. No current GUI-only path producing this same-wallet descriptor change was identified.


Link

[minor] · Wallet changes leave a save dialog that silently writes nothing

If wallet selection changes while the native save dialog is open, accepting it after the popup closes produces neither a file nor an error.

Location: qml/components/WatchOnlyExportModal.qml:136 (head).

Details and suggested fix

AppFileDialog opens a parentless QFileDialog asynchronously, so queued wallet-selection changes can still arrive while it is modal. onWalletChanged closes the export popup but never closes saveDialog. After the 150 ms exit transition, onClosed clears exports, making payload empty. Accepting the still-open chooser then calls save(), which returns without writing or reporting cancellation. Tie the chooser to the export session and explicitly close it when a wallet change invalidates that session. Acceptance during the exit window can still write the original payload; the established failure is the silent no-op after cleanup, not a wrong-wallet write.


Coverage details