Skip to content

qt: Encrypt Wallet blocks the GUI during existing-wallet encryption #172

Closed

Description

@kiwidream

Report

  • This GUI issue applies to this repository.
  • Existing issues were searched; no matching encryption-responsiveness issue was found.

Encrypting an existing populated testnet wallet makes qbit-qt appear frozen while the operation runs. During the September 23 inspection, the maintainer estimated roughly 20 seconds of apparent locking before the operation cleared. Encryption completed successfully and the wallet ended encrypted and locked. No persistent deadlock or data loss was observed.

This gives users no useful feedback during a sensitive wallet operation and can make a successful encryption look like a hung application.

Environment and reproduction

  • Source: 1.x.x at c4b254e2d39f3a430b8b4a85798dd03ed47c3d98; the build still reports v1.0.0.
  • Native Apple Silicon macOS 26.4, RelWithDebInfo, GUI and wallet enabled; testnet4.
  • Existing populated descriptor wallet, initially unencrypted, with the default 1,000-entry receive/change keypools. Use disposable test data for reproductions.
  1. Open the unencrypted wallet and let key validation finish.
  2. Choose Settings → Encrypt Wallet….
  3. Enter the new passphrase twice, click OK, then Continue in the encryption confirmation.
  4. Observe the interface until the encryption result appears.

Expected: The interface continues to repaint and displays that encryption is in progress; success or failure is clearly reported.

Observed: The interface appeared stuck until encryption finished. Subsequent getwalletinfo responded promptly with unlocked_until: 0, no pending/failed plaintext-key validation, and 1,000 entries in each active keypool.

Source evidence

The existing-wallet GUI path calls encryption synchronously:

Live observation showed about one CPU core in use and progress through receive/change descriptor activation. A process sample was captured after the expensive operation cleared, so it is not evidence of the active hot stack. Source inspection establishes the synchronous GUI call path. The deferred unlock work in #143 is a different path.

Proposed scope and acceptance

Move the long operation off the GUI event loop or otherwise keep that loop responsive, with a visible progress state and clear completion/error handling. Preserve encryption atomicity and key/counter semantics.

  • A GUI regression test keeps the encryption operation in progress and proves event-loop activity continues; it fails with the current synchronous implementation.
  • Repeated clicks cannot start a second encryption, and incompatible wallet actions cannot race the active operation.
  • Wallet unload, window close, and application shutdown safely wait for or complete the operation without accessing destroyed models. Do not introduce cancellation after an irreversible commit unless it has explicit safe semantics.
  • Success leaves the wallet encrypted and locked; its history, receive addresses, and signing counters remain usable after backup/reopen and an unlock/send/relock check.
  • Existing failure paths report errors, release temporary state appropriately, and do not weaken database transaction guarantees.
  • Manually encrypt a populated testnet wallet and record the result, elapsed time, and responsiveness. Preserve current wallet state when testing recovery; do not restore stale signing counters.

Consensus/wire-format changes and permanent wallet decryption are outside this issue. This is a release-quality responsiveness fix; the observed encryption itself succeeded.

Release tracking

Tracked by #174 — v1.0.1 release readiness.

Activity

  1. added
    bug
    on Sep 23, 2026
  2. added 3 commits that reference this issue on Sep 24, 2026
    1312189
    0bf19d1
    a32081e
  3. kiwidream commented on Sep 25, 2026

    @kiwidream
    MemberAuthor

    Fixed by #178, merged into 1.x.x as a32081e. Merging into 1.x.x doesn't close issues automatically because it isn't the default branch.

    Acceptance, as covered by #178:

    • Responsiveness: a GUI regression test holds encryption open and checks that the event loop keeps running. It fails on the old synchronous code.
    • No double start or racing actions: a second click can't start another encryption. Unlock, fee bump and payment requests are refused or queued while encryption runs.
    • Safe shutdown: unloading the wallet, closing the window or quitting the app waits for encryption to finish. It is never cancelled after the commit.
    • Final state: the wallet ends encrypted and locked. After reopening, its history and addresses are intact and unlock/send/relock works.
    • Failures: a clean failure shows the existing error message. An exception after the database commit stops the app instead of being reported as "not encrypted".

    Remaining: the manual run of encrypting a populated testnet wallet, recording elapsed time and responsiveness. It moves to the #174 packaged-RC smoke checks. Follow-ups: #179 (EncryptWallet races that predate this change) and #180 (a transaction-list repaint during encryption can still block).

  4. added a commit that references this issue on Nov 12, 2026
    3ccf788
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