HomePhabricator

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

Description

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).

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: deadalnix, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D4238

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Jun 20 2018, 14:15
nakihitoCommitted on Oct 12 2019, 04:45
nakihitoPushed on Oct 12 2019, 04:45
Reviewer
Restricted Owners Package
Differential Revision
D4238: Merge #13506: Qt: load wallet in UI after possible init aborts
Parents
rABC9a4a353f1328: Merge #13564: [wallet] loadwallet shouldn't create new wallets.
Branches
Unknown
Tags
Unknown