Page MenuHomePhabricator

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

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

Details

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

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 (https://github.com/bitcoin/bitcoin/pull/13097#issuecomment-398445833).

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
https://github.com/bitcoin/bitcoin/pull/13506/

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

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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