mirror of
https://github.com/bitcoin-core/gui-qml.git
synced 2026-12-02 07:54:42 +00:00
Wallet picker: An unnamed wallet supported by Core cannot be opened #1004
Labels
No labels
Android
Bug
Build system
Design suggestion
Doc
Needs design review
Needs rebase
Stage
UX
Up for grabs
Upstream
Wallet
duplicate
enhancement
good first issue
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin-core/gui-qml#1004
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I reproduced an unnamed wallet appearing as a blank “Failed to open wallet” entry. Clicking it doesn't load the wallet, although
loadwallet "" falsesucceeds in the same running application.To reproduce:
fixture_sourceandnamed_walletwithload_on_startup=false.backupwalletonfixture_sourceto place its backup at<walletdir>/wallet.dat, creating Core's unnamed-wallet layout. Use a fresh wallet directory where this destination does not already exist.fixture_source. Confirm that Core can load the backup withloadwallet "" false, then unload the unnamed wallet.-wallet=named_wallet.loadwallet "" falsethrough the GUI's RPC server.The picker showed an empty name and “Failed to open wallet” before and after clicking. RPC then loaded it successfully.
We should give this wallet a usable display name and allow loading it. This is an existing wallet layout supported by Core; it doesn't require creating a new wallet with an empty name.
Tested on
qt6at09c6de77d7f36bf7fa07c354ebeea51105c447a3, macOS arm64, Qt 6.9.0. I used a real descriptor wallet and the existing offscreen GUI test bridge. This did not test historical wallet-database migration.Related to the wallet discovery work in #966.
Two additional cases extend this beyond opening the unnamed wallet from the picker.
Using the Core-supported wallet whose name is
"", with a named wallet also loaded:loadwallet "". QML selects it and shows its correct balance. Choose Close Wallet and confirm. The dialog closes, butlistwalletsstill contains""and the wallet remains selected. The same Close action works for the named wallet.unloadwallet ""also works through Core RPC.getwalletinfoorgetbalancesin the GUI console. It says Executing command without any wallet and returns error -19 because multiple wallets are loaded. The equivalent command withbitcoin-cli -rpcwallet=succeeds and returns the unnamed wallet.Closing the named wallet does not fix the unnamed wallet's Close action. Console commands then succeed through Core's single-wallet fallback, but the console still claims to be operating without a wallet.
The picker, Close action and console need to distinguish a valid empty wallet name from no selected wallet. The failure is in GUI identity handling: Core can load, address and unload this wallet correctly.
Reproduced on
qt6at6e54a48ab571, macOS / Qt 6.9, using an isolated regtest fixture and the offscreen test bridge.One more case: when the unnamed wallet is a legacy (Berkeley DB) wallet, the app can neither open it nor update it, and there is no
loadwallet ""to fall back on.I placed the same legacy file at
<walletdir>/wallet.datand at<walletdir>/legacyctl/wallet.dat.listwalletdirlists both with the legacy warning, andlistwalletsis empty at start.legacyctlThe row's menu → Open wallet does the same as the click. Core treats the two names alike on the same node:
loadwalletrefuses both with "please use the wallet migration tool", andmigratewallet ""succeeds. So the only route for this wallet is the update, and the app never offers it. Bitcoin-Qt's File → Migrate Wallet lists it as "[default wallet]", by its source.The click stops at the empty-name check, before the legacy branch that opens the update prompt:
github.com/bitcoin-core/gui-qml@2bd5a61e83/qml/walletqmlcontroller.cpp (L1187-L1207)The update has an empty-name check of its own, so letting the click through would not be enough. I read that from the source; no control reaches it today:
github.com/bitcoin-core/gui-qml@2bd5a61e83/qml/walletqmlcontroller.cpp (L1244-L1249)A caution for anyone working around this by moving
wallet.datinto a named folder: ifsettings.jsonlists the unnamed wallet ("wallet": [""]), the node then refuses to start with "Failed to load database path … Data is not in recognized format." With that entry present the app failed to start 9 of 9 times. Remove the entry first.Reproduced on
qt6at2bd5a61e8304, macOS arm64 / Qt 6.9.0, isolated regtest, offscreen and native. The picker behaves the same ateed1f426fcb6. The legacy file was built withdb_load(one key, unencrypted). I repeated the picker rows offscreen with an unnamed HD wallet written by Bitcoin Core 29.0, with the same result, andmigratewallet ""completed on it and on an encrypted one with its passphrase. Clicks went through the test bridge.