Skip to content

Commit 773e39e

Browse files
MarcoFalkexdustinface
authored andcommitted
Merge bitcoin#13506: Qt: load wallet in UI after possible init aborts
3a03d2a Qt: load wallet in UI after possible init aborts (Jonas Schnelli) Pull request description: Bug was introduced in bitcoin#13063 (80b4910) where bitcoin#13097 made possible to get "hit" by that bug. Reported by @ken2812221 (bitcoin#13097 (comment)). 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
1 parent 4666e2c commit 773e39e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/wallet/wallet.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5041,8 +5041,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const WalletLocation& loc
50415041
}
50425042
}
50435043

5044-
uiInterface.LoadWallet(walletInstance);
5045-
50465044
if (gArgs.GetBoolArg("-upgradewallet", fFirstRun))
50475045
{
50485046
int nMaxVersion = gArgs.GetArg("-upgradewallet", 0);
@@ -5217,6 +5215,8 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const WalletLocation& loc
52175215
}
52185216
}
52195217

5218+
uiInterface.LoadWallet(walletInstance);
5219+
52205220
// Register with the validation interface. It's ok to do this after rescan since we're still holding cs_main.
52215221
RegisterValidationInterface(walletInstance.get());
52225222

0 commit comments

Comments
 (0)