Page MenuHomePhabricator

Merge #13506: Qt: load wallet in UI after possible init aborts

Authored by nakihito on Oct 10 2019, 22:54.


Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
rABC962952f31a0a: Merge #13506: Qt: load wallet in UI after possible init aborts

3a03d2a33f Qt: load wallet in UI after possible init aborts (Jonas Schnelli)

Pull request description:

Bug was introduced in #13063 (80b4910f7d87983f50047074c3c2397b0a5c4e92) where #13097 made possible to get "hit" by that bug. Reported by @ken2812221 (

Dynamically loading a wallet informs the UI (and therefore makes the instance accessible) about the new wallet before all possible error cases where handled.

Easy to reproduce by starting `bitcoin-qt --regtest --nowallet -usehd=0` then in the console enter `loadwallet wallet.dat`.

This PR will make sure only correctly initialised (loaded) wallets will appear in the UI.

Tree-SHA512: 3139545e852d53b117182b579f45259c198d1c25c1a6fa4e0108f942d45f6fe2691e6bfcbbae2e18c33ad0174a520f379c17867b1eb87f950d830a5f519fec4f

Backport of Core PR13506

Depends on D4236

Test Plan
make check
bitcoin-qt --regtest --nowallet -usehd=0
Help -> Debug -> Console
loadwallet wallet.dat

Before this patch, the gui would throw an error window, but the wallet would still be selectable from the multiwallet drop down menu and the wallet information would still be displayed on the main window.
After this patch, the gui should throw an error window and there should still be no wallet loaded and/or displayed in the main window.
In both cases, the console will output Wallet loading failed. (error code -4).

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

nakihito created this revision.Oct 10 2019, 22:54
Owners added a reviewer: Restricted Owners Package.Oct 10 2019, 22:54
Herald added a reviewer: Restricted Project. · View Herald TranscriptOct 10 2019, 22:54
nakihito planned changes to this revision.Oct 10 2019, 22:54
nakihito requested review of this revision.Oct 11 2019, 23:16
deadalnix accepted this revision.Oct 12 2019, 01:30
This revision is now accepted and ready to land.Oct 12 2019, 01:30