Skip to content

Review finding: unloading a wallet mid-signing discards a signed PSBT and reports failure #326

Closed

Description

@kiwidream

Summary

Wallet unload during a worker's progress dialog is not deferred; a successfully signed PSBT is then discarded and reported as a signing failure.

Severity: low. Found in the 2026-11-04 review of the v1.0.1 change set (all 1.x.x merges since v1.0.0 plus the open PRs that target it), against 1.x.x 21fee6ee8e; area: #145, #167.

Observed

Confidence: confirmed (proven from code) for the reachability of the unload. The discard is asserted by the existing test.

  • Location: src/qt/walletcontroller.cpp:205-214 (unload is deferred only when the active modal widget is not a QProgressDialog), src/qt/psbtoperationsdialog.cpp:300-305.
  • Scenario: The upstream exemption for QProgressDialog (c391858, meant for wallet-activity progress) now also covers qbit's new worker progress dialogs, which are application-modal QProgressDialogs.
    • PSBT: qbit-cli unloadwallet while the PSBT signing progress dialog is shown makes removeAndDeleteWallet run at once. The WalletModel is deleted (the PSBT dialog survives under WalletFrame), and the worker completes the signing. signTransactionFinished then reports "Failed to sign transaction: Wallet is no longer loaded." plus "The signing attempt failed after consuming PQC signature capacity", and keeps the original unsigned PSBT. Signing actually succeeded and the PSBT needs no wallet to be copied, saved or broadcast. Re-signing after a reload consumes fresh counters.
    • Fee bump: the same unload during the bump progress dialog makes ~WalletModel join the worker on the GUI thread (finishBumpFeeThread) for the remaining signing and commit, with no progress UI.
    • Send prepare: this already happened in v1.0.0 (~SendCoinsDialog joins).
  • Evidence: Code trace. The test only simulates the unload by fixture.wallet_model.reset(). Not reproduced through WalletController.

Impact

A completed signing is misreported as a failure and a durable-capacity artifact is thrown away. walletUnloadDuringSigning (psbtoperationsdialogtests.cpp:397-414) asserts this discard behaviour, so the test locks it in.

Suggested fix

When !m_wallet_model at completion and the result is error-free, keep result->psbt (renderTransaction already handles a null model). Report "signed; the wallet was unloaded" with the Consumed outcome. Alternatively, defer unload while a PSBT, bump or send worker is active (narrow the QProgressDialog exemption to the activity dialogs, for example with an object name or a dedicated subclass check).

Activity

  1. added
    bug
    on Nov 4, 2026
  2. kiwidream commented on Nov 6, 2026

    @kiwidream
    MemberAuthor

    Fixed on 1.x.x by #344 (merged as b5486bf) for PSBT signing. When the wallet is unloaded mid-signing, the dialog keeps and shows the signed PSBT and reports it as signed, with the usage block and "The wallet was unloaded while signing." Copy, Save and Broadcast stay available. The fee-bump and Send-preparation cases this issue also describes are tracked in #356. main gets the fix when 1.x.x is integrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions