WIP: qt: refactor QML frontend onto owned models

bitcoin-core/gui-qml: PR #1142

7 minor findings · 3 suggestions

Earlier concerns neither republished nor resolved: 11 minor findings · 9 suggestions. See the Run archive for their assessments.

Findings

Link

[minor] · Captured creation passphrases remain in unwiped QString storage

Wallet creation retains the captured plaintext passphrase in its immutable request after native use, extending its exposure to process-memory disclosure for as long as the result projection retains the service.

Location: qml/walletcreationcontroller.cpp:159 (head).

Details and suggested fix

WalletCreationController::create() assigns the captured input to both credential fields, and walletcreation::Service stores that request as const Request m_request. Completing creation does not release it. secretinput::Input::materialize() cleanses its temporary UTF-8 buffer, but not the retained QString; closing the operation eventually releases that storage without wiping it. Keep consumable credentials outside the immutable result metadata, use exclusively owned cleansing storage, and release them after their last native use. Add a test that a completed, acknowledged creation result no longer retains the credential. QML-side text copies remain outside this guarantee, and exploiting the exposure requires access to process memory.


Link

[minor] · Rejected signer responses change later file exports to PSBT v2

For an app-created review without a PSBT, rejecting a substituted or invalid signer response still installs the unsigned v2 hand-off document, so Save no longer produces the v0 file expected by older cosigners.

Location: qml/walletsend.cpp:651 (head).

Details and suggested fix

ExecuteApproval() constructs a version 2 document when request.document is empty. Its changed-transaction, invalid-fee and invalid-signature branches return the original approved document, even though the attempt added no accepted signatures. publishApproval() installs that document before reporting the failure. Save then takes the existing-document branch directly instead of the version 0 construction in ExportReview(), producing a file that Core 31 and older cannot read. Do not install a failed attempt's document when it adds no signatures, and add a rejected-approval-then-Save version test. This does not require changing the v2 device hand-off or the version of imported PSBTs.


Link

[minor] · Proxy endpoints are validated trimmed but saved untrimmed

The settings editor accepts a whitespace-padded proxy endpoint after trimming it for validation, but saves the raw text that Core rejects at the next startup.

Location: qml/effectivesettings.cpp:85 (head).

Details and suggested fix

EffectiveSettingRow forwards the edited text unchanged, and Session::editText() stores it unchanged. Policy() validates through ProxyValidationError(), which trims the endpoint, while Stored() persists the original string. For example, 127.0.0.1:9050 passes validation, but the trailing space prevents Core's SplitHostPort() from parsing the port. Startup passes that unnormalized value to Lookup() and reports an invalid proxy address. Normalize proxy and onion endpoints before constructing the saved edit, and test the exact persisted value. The running node is unaffected until restart; the user must correct the saved setting to recover.


Link

[minor] · A refused fee-bump commit leaves the attempt Uncertain

A narrow race after the last eligibility check can leave a definite non-commit in Uncertain, blocking reset and retry within that attempt; no production occurrence was shown.

Location: qml/walletbump.cpp:206 (head).

Details and suggested fix

If the original confirms, gains a descendant or disappears after the last scope check, commitBumpTransaction() can return false. At the pinned Core revision, these refusals happen before wallet.CommitTransaction(); even a later MarkReplaced() failure returns OK. Execute() maps the refusal to Error::Commit, but publishCommit() maps that error to Uncertain. The model then refuses reset and preparation, and observing the outcome changes only its message. Map this definite refusal to Failed or NeedsRevalidation, retaining Uncertain for outcomes such as exceptions where a commit cannot be excluded.


Link

[minor] · Refused receive types stay hidden after descriptor import

After Core refuses an address type, importing an active descriptor for that type does not restore it to Receive until the wallet is unloaded and reopened.

Location: qml/walletopening.cpp:540 (head).

Details and suggested fix

markReceiveTypeUnavailable() only inserts into the opening's negative cache, and both default selection and the offered-type list skip cached types. Activating a descriptor calls Core's NotifyCanGetAddressesChanged(), but the application's handler only refreshes metadata and never invalidates that cache. A partial-descriptor wallet can therefore keep hiding a type it can now generate. Clear or re-probe negative capability results when the descriptor capability notification arrives, and add a refusal-then-import regression test.


Link

[minor] · Polls restart slow receipt scans before later entries are checked

With more than 128 unconfirmed receipts and consistently slow batches, the one-second poll can repeatedly restart the scan and starve later receipts; no production occurrence was shown.

Location: qml/walletreceipts.cpp:439 (head).

Details and suggested fix

Reader::poll() sets m_poll even during an active batch. The next plan() consumes it and calls restartRechecks(), resetting the cursor before collecting at most 128 transaction IDs. Each plan publishes Pending, which rearms the GUI's one-second timer. If batches consistently exceed that interval while the early entries remain unconfirmed, the follow-up work repeatedly starts at the beginning and reconciliation cannot settle. Coalesce timer polls while a recheck snapshot is unfinished, and test a poll arriving before each batch completes. Progress can resume when batches become faster.


Link

[minor] · Discarded clipboard checks accumulate until the Send page is destroyed

While Send is active with non-empty clipboard text, repeated recipient edits retain cancelled PaymentImportOperation objects and their projection entries for the page's lifetime.

Location: qml/models/sendimportmodel.cpp:235 (head).

Details and suggested fix

recipientEdited calls checkClipboard(), which disconnects and cancels the previous check before requesting another operation owned by SendImportModel. BitcoinUriModel::createImport() allocates that QObject and removes its projection entry only on destruction. PaymentImportOperation::cancel() closes the actor but never deletes the object, so every accepted replacement leaves another child behind. Schedule discarded checks for deletion after cancellation, and test that repeated recipient edits keep the operation child count bounded.


Optional improvements

Link

[suggestion] · Speed Up omits the reuse filter now applied by Send

Speed Up can add dirty inputs on an avoid_reuse wallet, a pre-existing behavior shared with Core's bumpfee but now inconsistent with the app's Send policy.

Location: qml/walletbump.cpp:106 (head).

Details and suggested fix

walletbump::Prepare() leaves m_avoid_address_reuse at its false default. Core copies that control, retains the mandatory original inputs and enables selection of additional inputs. Its available-coin filter permits used addresses when this flag is false, whereas the new Send policy sets it true. Set the reuse filter for additional input selection in Prepare() as well, and add a replacement test with both dirty and clean candidate inputs. The filter remains conditional on the wallet having avoid_reuse enabled.


Link

[suggestion] · Console redaction still retains importdescriptors private keys

The pre-existing importdescriptors redaction gap, also present in pinned Bitcoin-Qt, leaves private-key descriptors visible in request output and recallable in session history.

Location: qml/models/rpccommandexecutor.cpp:28 (head).

Details and suggested fix

HISTORY_FILTER omits importdescriptors, so a command containing an xprv, tprv or WIF descriptor reaches prepared->filtered() unchanged. RpcConsoleModel uses that text for both the request row and Up-arrow history, including before execution can fail. Redact these arguments as well and add a private-descriptor regression test. This would deliberately extend the inherited Widgets policy, so update the parity expectation explicitly rather than treating the existing list as comprehensive private-key protection.


Link

[suggestion] · Executor test assertion failures can hang teardown

An assertion failure in cleanupUtilityWorkerIsSeparateFromIoAndJoinedOnStop can return before releasing its worker, turning the intended test failure into a teardown hang.

Location: test/test_executor.cpp:334 (head).

Details and suggested fix

The cleanup callback waits on release_future, but the test asserts I/O admission, completion and thread identity before fulfilling release_cleanup. A failed QTest assertion returns from the function. Because executor was declared after the promise, its destructor runs first and stopAndJoin() waits for the still-blocked cleanup callback. In particular, accidentally sharing the Cleanup and IO worker would make the I/O timeout hang rather than report the regression. Record the results, release the barrier and join before asserting, as stopJoinsThreadLocalDestruction() already does.


Coverage details

Earlier concerns

Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.

Background

Ralph's summary of historical context for the behaviour affected by this change. The historical record reviewed here is incomplete.

Documented decisions

Moving wallet creation or loading into a worker is insufficient for responsiveness: discovery, preflight checks, completion-time metadata queries and removal can independently block on filesystem operations, wallet locks or pending notifications.

Historical issue #966 explicitly calls for cached display getters, background discovery and removal, execution-time rechecks and retention of resources until outstanding work ends. This explains why the affected behavior spans wallet catalogs, opening, selection and closing—not merely the transaction-signing path—and why the refactor introduces pending and retirement states.

Source 1

Disconnecting notifications is not equivalent to completing callbacks or making model destruction safe. Earlier Core GUI work distinguished backend callback lifetime from queued Qt delivery and model deletion.

Core #18338 documented that unregistering a validation interface could leave invocations in flight, and that the GUI needed a queued unload connection to avoid destroying a model while it was being used. This is historical context for the application's owned work, wallet retirement and staged shutdown. The base executor already retained worker captures and tracked asynchronous joins; the new ownership architecture extends an existing lifetime constraint rather than introducing background execution from scratch.

Source 1 · Source 2

PSBT was designed to separate transaction construction from signing across different software and offline devices. Providing enough authenticated spending information competes with compact transport and compatibility with existing signers.

BIP174 expressly motivates cross-client signature exchange and offline signing without direct UTXO-set access. Core #19215 subsequently supplied full previous transactions for SegWit hardware signers while retaining witness_utxo for older software; an inspected user comment reports the resulting size burden for printed QR transport. These constraints explain why import, metadata enrichment, local signing, external approval and export are separate workflows, rather than a single wallet-owned Send action.

Source 1 · Source 2 · Source 3 · Source 4

External signing supplies signatures, not permission to substitute the transaction being approved. The historical hardening proposal also distinguishes transaction-level checks from protection against a malicious helper process running as the same operating-system user.

Core #36114 explicitly proposes merging signer responses instead of replacing the request, rejecting changed outputs and unsafe signing forms, while disclaiming complete protection against a same-user malicious HWI process. At the unchanged pinned Core revision, ExternalSigner::SignTransaction instead assigns the decoded response to the PSBT. This explains the application's separate comparison of reviewed transaction terms and its checks after signing, without treating those checks as a general sandbox for the signer executable.

Source 1

PSBT file-export defaults carry an interoperability tradeoff distinct from the external-signer interface. Upstream discussion favored v0 GUI exports for older participants while ultimately retaining v2 for external signing; backport translation constraints also discouraged adding a version-selection control.

Issue #36518 records failures when GUI-created v2 files reach pre-v32 Core nodes and questions the immediate GUI benefit of v2. In #36539, maintainers discuss avoiding new translated UI during a backport, and the author later records retaining v2 for external signers. This directly contextualizes the application's ExportReview distinction between newly created v0 files, imported documents whose version is preserved, and an unchanged signer hand-off.

Source 1 · Source 2 · Source 3 · Source 4 · Source 5

Unsaved settings belong to a user editing session, not merely to the currently visible page. Navigation paths that destroy a page must preserve the draft or obtain consent to discard it.

Historical issue #1065 describes proxy edits protected by the page's Back button but silently lost through sidebar navigation, Settings Done or onboarding close. Its stated expectation explains the new SettingsNavigationController's pending navigation and editor-close question: the consent requirement must span all exits, including exits owned outside the editor page.

Source 1

RPC request display and recall history are separate disclosure surfaces from RPC execution. Failed commands can still reveal secrets, and clearing visible output need not remove recallable history.

Issue #1078 documents passphrase and private-key arguments retained even when the underlying commands fail, and notes that QML maintains its own copy of the Widgets console's filtering policy. This explains transient executable command plans and filtering before retention, as well as the need to track relevant upstream policy changes independently of whether the application links the Widgets GUI.

Source 1

On a pruned node, closing a wallet has a recoverability cost beyond hiding its UI: blocks needed to bring that wallet's history forward can disappear while it is unloaded, requiring a chain download before reopening.

Historical issue #1127 distinguishes an intact wallet file from unavailable scan data and contrasts an unloaded wallet with one left synchronized. This explains the pruning-specific Close wallet warning as disclosure of a storage-versus-later-rescan tradeoff, not a claim that closing destroys keys or funds.

Source 1

Ralph's inferences

A PSBT analysis result and an authenticated fee authorization answer different questions. A GUI fee promise must be tied to the exact reviewed transaction and supported input values, rather than inferred merely from the presence of a numeric analysis fee.

The base broadcast path consumes AnalyzePSBT().fee. At the unchanged Core pin, that analysis totals values obtained from PSBT input data. The head application instead records verified prevouts and a transaction commitment, displays its own fee proof, and checks that proof again during execution. Together with PSBT's offline trust model, this supports interpreting the new proof as an authorization boundary rather than just duplicate fee arithmetic.

Source 1

Long-running operations need a stable authorization target and an outcome that can outlive the page. Cancelling presentation is not necessarily cancelling an already admitted financial effect, and committing to wallet history is not itself proof of successful network submission.

The head architecture binds wallet pages for life and captures operation identity, while retaining post-commit effects independently of page visibility. The pinned wallet interface returns void from commitTransaction; the send adapter therefore preserves the committed candidate and observes subsequent state. These contracts explain the distinction between retiring a prompt, draining accepted work and reporting an observed or uncertain outcome.