qml: Keep the app usable while an imported wallet rescans #986

Open
AndreaDiazCorreia wants to merge 4 commits from fix/wallet-import-rescan-nonblocking into qt6 AGit
AndreaDiazCorreia commented 2026-10-08 00:16:49 +00:00 (Migrated from github.com)

Fixes #840.

An import set the same flag as a wallet load and kept its dialog open until restoreWallet() returned, so the app stayed locked for the whole rescan.

  • Track the import separately. Only operations that would queue behind it on the wallet worker are refused; open wallets can still be used.
  • Show the importing wallet in the wallet selector with a spinner.
  • Let the import dialog close during the rescan. If it was closed, the result shows as a banner: a finished import offers to open the wallet, a failed one offers to show the error.
  • Ask for confirmation before quitting while an import runs, since quitting drops it.

Unit and QML tests cover the new state, the selector and the dialog. Tested by hand on regtest with a rescan of about six minutes.

Fixes #840. An import set the same flag as a wallet load and kept its dialog open until restoreWallet() returned, so the app stayed locked for the whole rescan. - Track the import separately. Only operations that would queue behind it on the wallet worker are refused; open wallets can still be used. - Show the importing wallet in the wallet selector with a spinner. - Let the import dialog close during the rescan. If it was closed, the result shows as a banner: a finished import offers to open the wallet, a failed one offers to show the error. - Ask for confirmation before quitting while an import runs, since quitting drops it. Unit and QML tests cover the new state, the selector and the dialog. Tested by hand on regtest with a rescan of about six minutes.
jarolrod (Migrated from github.com) reviewed 2026-10-10 19:33:06 +00:00
jarolrod (Migrated from github.com) left a comment

#991 is an existing backup bug that this PR makes easier to reach.

The backup dialog uses selectedWallet when accepted, rather than retaining the wallet it was opened for. I reproduced this on qt6: open A’s backup dialog, load B through RPC, then accept. Restoring the saved file confirmed it contained B. This also replaced an existing A backup after the normal overwrite confirmation.

With background imports, the same sequence appears possible entirely through the GUI:

  1. Start importing B, then dismiss the import window.
  2. While B is importing, open A’s backup dialog.
  3. B finishes loading and becomes selected.
  4. Accepting the dialog backs up B to A’s intended destination.

The RPC route is reproduced end to end; the import route above is based on reviewing this PR’s code.

But I think we will want to close out that issue before moving with async stuff here.

[#991](https://github.com/bitcoin-core/gui-qml/issues/991) is an existing backup bug that this PR makes easier to reach. The backup dialog uses `selectedWallet` when accepted, rather than retaining the wallet it was opened for. I reproduced this on `qt6`: open A’s backup dialog, load B through RPC, then accept. Restoring the saved file confirmed it contained B. This also replaced an existing A backup after the normal overwrite confirmation. With background imports, the same sequence appears possible entirely through the GUI: 1. Start importing B, then dismiss the import window. 2. While B is importing, open A’s backup dialog. 3. B finishes loading and becomes selected. 4. Accepting the dialog backs up B to A’s intended destination. The RPC route is reproduced end to end; the import route above is based on reviewing this PR’s code. But I think we will want to close out that issue before moving with async stuff here.
AndreaDiazCorreia commented 2026-10-13 22:02:29 +00:00 (Migrated from github.com)

@jarolrod thanks for catching this. I opened #1009 to fix #991: the backup dialog now pins the wallet it was opened for, so a selection change while it is open (including a background import finishing) can no longer redirect the backup. I'll rebase this PR once that one is merged.

@jarolrod thanks for catching this. I opened #1009 to fix #991: the backup dialog now pins the wallet it was opened for, so a selection change while it is open (including a background import finishing) can no longer redirect the backup. I'll rebase this PR once that one is merged.
johnny9 (Migrated from github.com) reviewed 2026-10-14 00:48:38 +00:00
johnny9 (Migrated from github.com) left a comment

ACK 670b588a386bf3dc9500fc299bb2192fb49ba845

ACK 670b588a386bf3dc9500fc299bb2192fb49ba845
uqlidi (Migrated from github.com) reviewed 2026-10-15 16:34:30 +00:00
uqlidi (Migrated from github.com) commented 2026-10-15 16:31:58 +00:00

If the modal is closed, a failed import reopens it but a successful one shows nothing. The flow is destroyed with the modal, so its onWalletImportSucceeded never runs.

Can we show a toast here with an "Open" action?

If the modal is closed, a failed import reopens it but a successful one shows nothing. The flow is destroyed with the modal, so its `onWalletImportSucceeded` never runs. Can we show a toast here with an "Open" action?
uqlidi (Migrated from github.com) commented 2026-10-15 16:32:18 +00:00

If the user quits while the import is running, shutdown aborts the rescan and restoreWallet() fails. Then this reopens the import modal with "Failed to rescan the wallet during initialization" on top of the shutdown screen. I hit it 2/2 times.

Clearing the import state in unloadWallets() fixes it (tested):
github.com/bitcoin-core/gui-qml@670b588a38/qml/walletqmlcontroller.cpp (L300-L306)

void WalletQmlController::unloadWallets()
{
    if (m_handler_load_wallet) {
        m_handler_load_wallet->disconnect();
    }
    // Shutdown aborts the rescan; don't report it as a failed import.
    setImportingWalletName(QString());
    m_selected_wallet = m_empty_wallet;
    Q_EMIT selectedWalletChanged();

Also the new subheading says "You can close this window and keep using the app", but quitting drops the import and the wallet isn't there after restart. Maybe warn on quit while importing?

If the user quits while the import is running, shutdown aborts the rescan and `restoreWallet()` fails. Then this reopens the import modal with "Failed to rescan the wallet during initialization" on top of the shutdown screen. I hit it 2/2 times. Clearing the import state in `unloadWallets()` fixes it (tested): https://github.com/bitcoin-core/gui-qml/blob/670b588a386bf3dc9500fc299bb2192fb49ba845/qml/walletqmlcontroller.cpp#L300-L306 ```cpp void WalletQmlController::unloadWallets() { if (m_handler_load_wallet) { m_handler_load_wallet->disconnect(); } // Shutdown aborts the rescan; don't report it as a failed import. setImportingWalletName(QString()); m_selected_wallet = m_empty_wallet; Q_EMIT selectedWalletChanged(); ``` Also the new subheading says "You can close this window and keep using the app", but quitting drops the import and the wallet isn't there after restart. Maybe warn on quit while importing?
uqlidi (Migrated from github.com) commented 2026-10-15 16:31:07 +00:00

When the import finishes, addOrSelectWalletModel() selects the imported wallet. Before this PR it was fine because the modal blocked everything. Now the user can be working in another wallet when the rescan ends, and the app switches wallets under them.

I tested it: closed the modal, went to Send on main and typed 0.5. When the import finished, the badge switched to bigwallet and the Send form was cleared. This is also how #991 can happen from the GUI only.

Shouldn't we keep the current wallet selected and let the user open the imported one? Something like:

const bool background_import = wallet && m_selected_wallet != m_empty_wallet
    && QString::fromStdString(wallet->getWalletName()) == m_importing_wallet_name;
addOrSelectWalletModel(std::move(wallet), /*select=*/!background_import);

Same for the worker success path: github.com/bitcoin-core/gui-qml@670b588a38/qml/walletqmlcontroller.cpp (L381)

Also importWalletLeavesLoadedWalletsSelectable asserts the switch: github.com/bitcoin-core/gui-qml@670b588a38/test/test_walletqmlcontroller.cpp (L576)

Is that intended?

When the import finishes, `addOrSelectWalletModel()` selects the imported wallet. Before this PR it was fine because the modal blocked everything. Now the user can be working in another wallet when the rescan ends, and the app switches wallets under them. I tested it: closed the modal, went to Send on `main` and typed 0.5. When the import finished, the badge switched to `bigwallet` and the Send form was cleared. This is also how #991 can happen from the GUI only. Shouldn't we keep the current wallet selected and let the user open the imported one? Something like: ```cpp const bool background_import = wallet && m_selected_wallet != m_empty_wallet && QString::fromStdString(wallet->getWalletName()) == m_importing_wallet_name; addOrSelectWalletModel(std::move(wallet), /*select=*/!background_import); ``` Same for the worker success path: https://github.com/bitcoin-core/gui-qml/blob/670b588a386bf3dc9500fc299bb2192fb49ba845/qml/walletqmlcontroller.cpp#L381 Also `importWalletLeavesLoadedWalletsSelectable` asserts the switch: https://github.com/bitcoin-core/gui-qml/blob/670b588a386bf3dc9500fc299bb2192fb49ba845/test/test_walletqmlcontroller.cpp#L576 Is that intended?
Lines 1325-1331
uqlidi (Migrated from github.com) commented 2026-10-15 16:33:51 +00:00

"Only the import can report a load error while it runs" is only true now because the other callers are guarded. Any new setWalletLoadError() call during an import will stop tracking it and open the import error modal for an unrelated error.

Why not emit it from the import failure lambda instead?

void WalletQmlController::setWalletLoadError(const QString& error)
{
    if (m_wallet_load_error != error) {
        m_wallet_load_error = error;
        Q_EMIT walletLoadErrorChanged();
    }
}
QMetaObject::invokeMethod(this, [this, error, warnings]() {
    setWalletLoadWarnings(warnings);
    setWalletLoadError(error.isEmpty() ? tr("Wallet import failed.") : error);
    if (walletImportInProgress()) {
        setImportingWalletName(QString());
        Q_EMIT walletImportFailed();
    }
});

nit: the setWalletLoadInProgress(false) calls in both import lambdas aren't needed anymore. Import doesn't set that flag.

github.com/bitcoin-core/gui-qml@670b588a38/qml/walletqmlcontroller.cpp (L1062)
github.com/bitcoin-core/gui-qml@670b588a38/qml/walletqmlcontroller.cpp (L1075)

"Only the import can report a load error while it runs" is only true now because the other callers are guarded. Any new `setWalletLoadError()` call during an import will stop tracking it and open the import error modal for an unrelated error. Why not emit it from the import failure lambda instead? ```suggestion void WalletQmlController::setWalletLoadError(const QString& error) { if (m_wallet_load_error != error) { m_wallet_load_error = error; Q_EMIT walletLoadErrorChanged(); } } ``` ```cpp QMetaObject::invokeMethod(this, [this, error, warnings]() { setWalletLoadWarnings(warnings); setWalletLoadError(error.isEmpty() ? tr("Wallet import failed.") : error); if (walletImportInProgress()) { setImportingWalletName(QString()); Q_EMIT walletImportFailed(); } }); ``` nit: the `setWalletLoadInProgress(false)` calls in both import lambdas aren't needed anymore. Import doesn't set that flag. https://github.com/bitcoin-core/gui-qml/blob/670b588a386bf3dc9500fc299bb2192fb49ba845/qml/walletqmlcontroller.cpp#L1062 https://github.com/bitcoin-core/gui-qml/blob/670b588a386bf3dc9500fc299bb2192fb49ba845/qml/walletqmlcontroller.cpp#L1075
johnny9 (Migrated from github.com) approved these changes 2026-10-29 17:42:02 +00:00
johnny9 (Migrated from github.com) left a comment

ACK fc26982db3

Tested closing the import dialog during a rescan, switching open wallets, and quitting during an import. Wallet selection and Send input were preserved when the import finished.

A persistent scanning indicator would make the background work clearer. That can be added in a follow-up.

ACK fc26982db3c35a03d3899a61880f266da89b2a40 Tested closing the import dialog during a rescan, switching open wallets, and quitting during an import. Wallet selection and Send input were preserved when the import finished. A persistent scanning indicator would make the background work clearer. That can be added in a follow-up.
First-time contributor

🟠 Minor · Import busy state clears before restoreWallet() returns

Handling Core's early load notification clears import progress before restore completion, allowing precisely timed actions to queue more work or lose or misattribute the success notification.

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

🟠 Minor · Import success tests can outlive their fake wallet state

The two new import success tests use a non-draining controller, allowing asynchronous unload cleanup to access destroyed FakeWallet::State locals.

Location: test/test_walletqmlcontroller.cpp:814 (head).

🟠 Minor · Migration can queue behind a background import

Unlike create and import, migration does not check walletWorkerBusy(), so confirmation during a background rescan can queue a delayed migration that later changes the selected wallet.

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

🟠 Minor · A failed import can leave a nonexistent wallet in the selector

Refreshing the selector during an import makes its row directory-backed, so a later restore failure preserves it as a closed wallet even after Core removes the copied database.

Location: qml/models/walletlistmodel.cpp:179 (head).

🔵 Suggestion · Background import failures interrupt the active workflow

Unlike success, a background import failure automatically opens a focused modal without checking whether the user is already working in another dialog.

Location: qml/pages/MainWindow.qml:369 (head).

Review coverage was incomplete.


Reviewed: fc26982db3c3 · Full review report · Previous reports

permalink

<!-- ralph:bitcoin-core/gui-qml --> <!-- ralph-engine:current:965af1044d9e41839565702e4d9bd0a751eda81f6e8b6402747fa296ef84ebea:f7677f01bbeeeda2e9dfb365f1407384e31618edbeddff6daa5ff425bb8651e2 --> <!-- ralph-base:6cdad5344018f35e8c33c77a23f6ba996d507549 --> <!-- ralph-head:fc26982db3c35a03d3899a61880f266da89b2a40 --> <!-- ralph-case:db51b06e3ed27b0d0c89eebd6373fca95c5cacfb54cf9537edff6aa151695812 --> **🟠 Minor · Import busy state clears before restoreWallet() returns** Handling Core's early load notification clears import progress before restore completion, allowing precisely timed actions to queue more work or lose or misattribute the success notification. Location: [`qml/walletqmlcontroller.cpp:484`](<https://git.fish.foo/bitcoin-core/gui-qml/src/commit/fc26982db3c35a03d3899a61880f266da89b2a40/qml/walletqmlcontroller.cpp#L484>) (head). **🟠 Minor · Import success tests can outlive their fake wallet state** The two new import success tests use a non-draining controller, allowing asynchronous unload cleanup to access destroyed FakeWallet::State locals. Location: [`test/test_walletqmlcontroller.cpp:814`](<https://git.fish.foo/bitcoin-core/gui-qml/src/commit/fc26982db3c35a03d3899a61880f266da89b2a40/test/test_walletqmlcontroller.cpp#L814>) (head). **🟠 Minor · Migration can queue behind a background import** Unlike create and import, migration does not check walletWorkerBusy(), so confirmation during a background rescan can queue a delayed migration that later changes the selected wallet. Location: [`qml/walletqmlcontroller.cpp:702`](<https://git.fish.foo/bitcoin-core/gui-qml/src/commit/fc26982db3c35a03d3899a61880f266da89b2a40/qml/walletqmlcontroller.cpp#L702>) (head). **🟠 Minor · A failed import can leave a nonexistent wallet in the selector** Refreshing the selector during an import makes its row directory-backed, so a later restore failure preserves it as a closed wallet even after Core removes the copied database. Location: [`qml/models/walletlistmodel.cpp:179`](<https://git.fish.foo/bitcoin-core/gui-qml/src/commit/fc26982db3c35a03d3899a61880f266da89b2a40/qml/models/walletlistmodel.cpp#L179>) (head). **🔵 Suggestion · Background import failures interrupt the active workflow** Unlike success, a background import failure automatically opens a focused modal without checking whether the user is already working in another dialog. Location: [`qml/pages/MainWindow.qml:369`](<https://git.fish.foo/bitcoin-core/gui-qml/src/commit/fc26982db3c35a03d3899a61880f266da89b2a40/qml/pages/MainWindow.qml#L369>) (head). Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`fc26982db3c3`](<https://git.fish.foo/bitcoin-core/gui-qml/commit/fc26982db3c35a03d3899a61880f266da89b2a40>) · [Full review report](<https://review.fish.foo/traces/gui/986-fc26982db3c35a03d3899a61880f266da89b2a40-1954-1.html>) · [Previous reports](<https://review.fish.foo/traces/986/>) [permalink](<https://review.fish.foo/traces/gui/986-fc26982db3c35a03d3899a61880f266da89b2a40-1954-1.html>)
rreview commented 2026-11-02 00:50:18 +00:00 (Migrated from github.com)

Earlier concerns remain unresolved; see the Run archive linked from the Review report.

🟠 Minor · Imports chosen during another wallet load are silently discarded

After a failed import, Details can reopen the import flow during another wallet load, where the enabled Import row accepts a file but importFile() silently discards it; this sequence is source-traced, not observed.

Location: qml/pages/wallet/WalletCreationFlow.qml:91 (head).

🔵 Suggestion · The import guidance omits possible stalls in wallet and chain updates

The invitation to keep using the app omits a pre-existing pinned-Core limitation: other wallets can stop updating during the import rescan, and sufficient queued callbacks can also stall chain progress.

Location: qml/pages/wallet/WalletCreationTypePage.qml:31 (head).

🔵 Suggestion · Import banners bypass ToastBanner's fade-out lifecycle

Both import banners replace visible instead of using shown, preventing ToastBanner from retaining visibility during its hide animation; the error banner also unnecessarily redeclares shown.

Location: qml/pages/MainWindow.qml:489 (head).

🔵 Suggestion · The quit-path rewrite shares a commit with controller and import-presentation changes

Commit e1b1f6f54ac990ee1b0c5a3cc8f787629712c01d combines platform quit routing, wallet-selection/error semantics, and closable-dialog/banner UI, making the shutdown change harder to validate independently.

Location: qml/pages/MainWindow.qml:98 at e1b1f6f54ac9 (commit) (commit).

Review coverage was incomplete.


Reviewed: 4cadb820ca0d · Review report

<!-- ralph-major:bitcoin-core/gui-qml --> Earlier concerns remain unresolved; see the Run archive linked from the Review report. **🟠 Minor · Imports chosen during another wallet load are silently discarded** After a failed import, Details can reopen the import flow during another wallet load, where the enabled Import row accepts a file but `importFile()` silently discards it; this sequence is source-traced, not observed. Location: [qml/pages/wallet/WalletCreationFlow.qml:91](<https://github.com/bitcoin-core/gui-qml/blob/4cadb820ca0dbf0bbef07108ba12eb15a29c9ca9/qml/pages/wallet/WalletCreationFlow.qml#L91>) (head). **🔵 Suggestion · The import guidance omits possible stalls in wallet and chain updates** The invitation to keep using the app omits a pre-existing pinned-Core limitation: other wallets can stop updating during the import rescan, and sufficient queued callbacks can also stall chain progress. Location: [qml/pages/wallet/WalletCreationTypePage.qml:31](<https://github.com/bitcoin-core/gui-qml/blob/4cadb820ca0dbf0bbef07108ba12eb15a29c9ca9/qml/pages/wallet/WalletCreationTypePage.qml#L31>) (head). **🔵 Suggestion · Import banners bypass `ToastBanner`'s fade-out lifecycle** Both import banners replace `visible` instead of using `shown`, preventing `ToastBanner` from retaining visibility during its hide animation; the error banner also unnecessarily redeclares `shown`. Location: [qml/pages/MainWindow.qml:489](<https://github.com/bitcoin-core/gui-qml/blob/4cadb820ca0dbf0bbef07108ba12eb15a29c9ca9/qml/pages/MainWindow.qml#L489>) (head). **🔵 Suggestion · The quit-path rewrite shares a commit with controller and import-presentation changes** Commit `e1b1f6f54ac990ee1b0c5a3cc8f787629712c01d` combines platform quit routing, wallet-selection/error semantics, and closable-dialog/banner UI, making the shutdown change harder to validate independently. Location: [qml/pages/MainWindow.qml:98 at e1b1f6f54ac9 (commit)](<https://github.com/bitcoin-core/gui-qml/blob/e1b1f6f54ac990ee1b0c5a3cc8f787629712c01d/qml/pages/MainWindow.qml#L98>) (commit). Review coverage was incomplete. <!-- Review tier: sensitive --> --- Reviewed: [`4cadb820ca0d`](<https://github.com/bitcoin-core/gui-qml/commit/4cadb820ca0dbf0bbef07108ba12eb15a29c9ca9>) · [Review report](<https://review.fish.foo/report/gui/986-4cadb820ca0dbf0bbef07108ba12eb15a29c9ca9-2731-7.html>)
johnny9 (Migrated from github.com) reviewed 2026-11-07 16:21:18 +00:00
johnny9 (Migrated from github.com) left a comment

Tested 9eb5f34bee3f on macOS 26.6.2 with Qt 6.11.2.

Two findings are already covered in rreview’s comment: the wallet row stuck as “Importing…” after a same-name import failure, and the quit confirmation opening inside a hidden window. Both are worth fixing, though the hidden-window issue is lower priority since restoring the window lets the user answer.

I also confirmed a separate native macOS quit bypass. During a real 20,000-block regtest rescan:

  • Calling the QML quit handler showed the confirmation; cancelling kept the import running.
  • Calling AppKit’s terminate: through a test-only bridge hook started shutdown without showing the confirmation.
  • The log recorded the rescan interrupted at block 40, and the incomplete imported wallet directory was removed.

QmlQuitHandler::quitRequested connects directly to NodeModel::requestShutdown() in qml/bitcoin.cpp, bypassing the new MainWindow.requestQuit() guard. Native quit requests should pass through the same import confirmation.

This exercises the native Cocoa termination path; physically clicking Dock → Quit was not tested.

Tested `9eb5f34bee3f` on macOS 26.6.2 with Qt 6.11.2. Two findings are already covered in [rreview’s comment](https://github.com/bitcoin-core/gui-qml/pull/986#issuecomment-6566445256): the wallet row stuck as “Importing…” after a same-name import failure, and the quit confirmation opening inside a hidden window. Both are worth fixing, though the hidden-window issue is lower priority since restoring the window lets the user answer. I also confirmed a separate **native macOS quit bypass**. During a real 20,000-block regtest rescan: - Calling the QML quit handler showed the confirmation; cancelling kept the import running. - Calling AppKit’s `terminate:` through a test-only bridge hook started shutdown without showing the confirmation. - The log recorded the rescan interrupted at block 40, and the incomplete imported wallet directory was removed. `QmlQuitHandler::quitRequested` connects directly to `NodeModel::requestShutdown()` in `qml/bitcoin.cpp`, bypassing the new `MainWindow.requestQuit()` guard. Native quit requests should pass through the same import confirmation. This exercises the native Cocoa termination path; physically clicking Dock → Quit was not tested.
AndreaDiazCorreia commented 2026-11-07 21:32:52 +00:00 (Migrated from github.com)

Thanks @johnny9 for testing. Fixed and squashed:

  • Tests keep the semaphores alive until the controller is drained.
  • A closed wallet with the same name no longer stays as "Importing…".
  • Platform quit (e.g. macOS terminate:) now asks for confirmation during an import; a quit from the tray shows the window first.
  • The import failure details are no longer lost when switching wallets.

Could you retest terminate: on macOS?

Thanks @johnny9 for testing. Fixed and squashed: - Tests keep the semaphores alive until the controller is drained. - A closed wallet with the same name no longer stays as "Importing…". - Platform quit (e.g. macOS terminate:) now asks for confirmation during an import; a quit from the tray shows the window first. - The import failure details are no longer lost when switching wallets. Could you retest terminate: on macOS?
johnny9 (Migrated from github.com) approved these changes 2026-11-08 00:32:52 +00:00
johnny9 (Migrated from github.com) left a comment

ACK a974a48da7

Retested on macOS 26.6.2 with Qt 6.11.2. AppKit terminate: through the test bridge now shows the import confirmation; cancelling preserves the rescan, and confirming shuts down. Hidden and minimized-then-hidden windows restored correctly. The wallet-row and import-error regression tests also pass.

The remaining retry and stale-confirmation issues already reported are minor and can be addressed in follow-ups.

ACK a974a48da76d78eb791baceb13b18d7641a9976b Retested on macOS 26.6.2 with Qt 6.11.2. AppKit `terminate:` through the test bridge now shows the import confirmation; cancelling preserves the rescan, and confirming shuts down. Hidden and minimized-then-hidden windows restored correctly. The wallet-row and import-error regression tests also pass. The remaining retry and stale-confirmation issues already reported are minor and can be addressed in follow-ups.
uqlidi (Migrated from github.com) approved these changes 2026-11-10 00:05:37 +00:00
uqlidi (Migrated from github.com) left a comment

ACK a974a48

ACK a974a48
jarolrod commented 2026-11-10 22:37:40 +00:00 (Migrated from github.com)

On current qt6 there is one page where Close stays available during an import, and the result is then lost. This PR's banners cover the lost result. One part of it looks untouched on this branch.

To reproduce at eed1f426fcb6:

  1. Open Add wallet → Import wallet and choose a file that is not a wallet backup. The error page appears.
  2. Click Choose another file and pick a valid backup whose restore takes several seconds.
  3. The error page stays on screen with its heading, description and help text now empty. Close is still shown and enabled.
  4. Click Close while the restore is running.

The dialog closes and nothing reports the outcome:

  • With a valid backup, the selected wallet switched to the imported one about 19 s later, with no Import complete page.
  • With a backup the pruned node could not restore, nothing was shown at all, and the wallet was simply absent.
  • Until the restore ended, the wallet picker's rows, their menus and Add wallet were disabled.

Controls in the same sessions reported the result correctly: leaving the dialog open, using Back instead of Close, and a first-attempt import, where Close is hidden while importing.

The error page has showCloseButton: modalView (WalletImportErrorPage.qml#L25), where the type page has modalView && !importingWallet (WalletCreationTypePage.qml#L33). Close ends the flow, so nothing is left to show the result.

At a974a48da76d, closing during an import is allowed and the result arrives as a banner, so the lost result goes away. WalletImportErrorPage.qml is unchanged on this branch, though, and startWalletImport clears the previous error before the retry (walletqmlcontroller.cpp#L1066-L1072). By source, a retried import still shows the error page with its cross icon, no text and no progress while the restore runs. I have not run this branch. The retry could show the same "Importing your wallet file…" state as a first attempt.

Reproduced on merged qt6 at eed1f426fcb6, macOS / Qt 6.9, isolated regtest, offscreen and native. The slow restore was produced with -keypool=60000, not a real rescan. File paths were supplied through the test-automation path field and clicks went through the test bridge.

On current `qt6` there is one page where Close stays available during an import, and the result is then lost. This PR's banners cover the lost result. One part of it looks untouched on this branch. To reproduce at `eed1f426fcb6`: 1. Open **Add wallet → Import wallet** and choose a file that is not a wallet backup. The error page appears. 2. Click **Choose another file** and pick a valid backup whose restore takes several seconds. 3. The error page stays on screen with its heading, description and help text now empty. Close is still shown and enabled. 4. Click Close while the restore is running. The dialog closes and nothing reports the outcome: - With a valid backup, the selected wallet switched to the imported one about 19 s later, with no **Import complete** page. - With a backup the pruned node could not restore, nothing was shown at all, and the wallet was simply absent. - Until the restore ended, the wallet picker's rows, their menus and Add wallet were disabled. Controls in the same sessions reported the result correctly: leaving the dialog open, using Back instead of Close, and a first-attempt import, where Close is hidden while importing. The error page has `showCloseButton: modalView` ([WalletImportErrorPage.qml#L25](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/pages/wallet/WalletImportErrorPage.qml#L25)), where the type page has `modalView && !importingWallet` ([WalletCreationTypePage.qml#L33](https://github.com/bitcoin-core/gui-qml/blob/eed1f426fcb64daa61b004590335a03afe376274/qml/pages/wallet/WalletCreationTypePage.qml#L33)). Close ends the flow, so nothing is left to show the result. At `a974a48da76d`, closing during an import is allowed and the result arrives as a banner, so the lost result goes away. `WalletImportErrorPage.qml` is unchanged on this branch, though, and `startWalletImport` clears the previous error before the retry ([walletqmlcontroller.cpp#L1066-L1072](https://github.com/bitcoin-core/gui-qml/blob/a974a48da76d78eb791baceb13b18d7641a9976b/qml/walletqmlcontroller.cpp#L1066-L1072)). By source, a retried import still shows the error page with its cross icon, no text and no progress while the restore runs. I have not run this branch. The retry could show the same "Importing your wallet file…" state as a first attempt. Reproduced on merged `qt6` at `eed1f426fcb6`, macOS / Qt 6.9, isolated regtest, offscreen and native. The slow restore was produced with `-keypool=60000`, not a real rescan. File paths were supplied through the test-automation path field and clicks went through the test bridge.
AndreaDiazCorreia commented 2026-11-10 23:55:28 +00:00 (Migrated from github.com)

@jarolrod Thanks for the report. Fixed in a5f9e6896b: choosing another file on the error page now returns to the page that shows "Importing your wallet file…", as a first attempt does, instead of leaving the emptied error page. With this branch, Close during that import also reports the result through the banner.

@jarolrod Thanks for the report. Fixed in a5f9e6896b: choosing another file on the error page now returns to the page that shows "Importing your wallet file…", as a first attempt does, instead of leaving the emptied error page. With this branch, Close during that import also reports the result through the banner.
AndreaDiazCorreia commented 2026-11-16 16:48:30 +00:00 (Migrated from github.com)

Rebased on qt6 after #1052 and addressed the rreview findings on a9b2ea2c99:

  • A background import failure now clears an earlier success banner, so only the latest result is shown.
  • Close Wallet is disabled for the wallet being imported, and closeWallet() refuses it, since the restore result would otherwise add it back. unloadwallet from the RPC console is not covered.
  • The quit confirmation is plain text since #1052 (AlertPopup.messageTextFormat defaults to Text.PlainText), so the wallet name is not read as markup.
  • The success banner hides once its wallet is no longer open.
Rebased on qt6 after #1052 and addressed the rreview findings on a9b2ea2c99ac: - A background import failure now clears an earlier success banner, so only the latest result is shown. - Close Wallet is disabled for the wallet being imported, and closeWallet() refuses it, since the restore result would otherwise add it back. unloadwallet from the RPC console is not covered. - The quit confirmation is plain text since #1052 (AlertPopup.messageTextFormat defaults to Text.PlainText), so the wallet name is not read as markup. - The success banner hides once its wallet is no longer open.
Sign in to join this conversation.
No description provided.