mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
wallet: List sqlite wallets with empty string name
Although it is not explicitly possible to create a default wallet with descriptors, it is possible to migrate a default wallet and have it end up being a default wallet with descriptors. These wallets should be listed by ListDatabases so that it appears in wallet directory listings to avoid user confusion.
This commit is contained in:
parent
3ddbdd1815
commit
6b2dcba076
2 changed files with 3 additions and 2 deletions
|
@ -42,12 +42,12 @@ std::vector<fs::path> ListDatabases(const fs::path& wallet_dir)
|
|||
(IsBDBFile(BDBDataFile(it->path())) || IsSQLiteFile(SQLiteDataFile(it->path())))) {
|
||||
// Found a directory which contains wallet.dat btree file, add it as a wallet.
|
||||
paths.emplace_back(path);
|
||||
} else if (it.depth() == 0 && it->symlink_status().type() == fs::file_type::regular && IsBDBFile(it->path()) && it->path().extension() != ".bak") {
|
||||
} else if (it.depth() == 0 && it->symlink_status().type() == fs::file_type::regular && it->path().extension() != ".bak") {
|
||||
if (it->path().filename() == "wallet.dat") {
|
||||
// Found top-level wallet.dat btree file, add top level directory ""
|
||||
// as a wallet.
|
||||
paths.emplace_back();
|
||||
} else {
|
||||
} else if (IsBDBFile(it->path())) {
|
||||
// Found top-level btree file not called wallet.dat. Current bitcoin
|
||||
// software will never create these files but will allow them to be
|
||||
// opened in a shared database environment for backwards compatibility.
|
||||
|
|
|
@ -539,6 +539,7 @@ class WalletMigrationTest(BitcoinTestFramework):
|
|||
assert_equal(info["format"], "sqlite")
|
||||
|
||||
walletdir_list = wallet.listwalletdir()
|
||||
assert {"name": info["walletname"]} in walletdir_list["wallets"]
|
||||
|
||||
# Check backup existence and its non-empty wallet filename
|
||||
backup_filename = f"default_wallet_{curr_time}.legacy.bak"
|
||||
|
|
Loading…
Add table
Reference in a new issue