diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -69,7 +69,7 @@ std::vector &warnings); std::shared_ptr CreateWallet(interfaces::Chain &chain, const std::string &name, - std::optional load_on_start, const DatabaseOptions &options, + std::optional load_on_start, DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector &warnings); std::unique_ptr HandleLoadWallet(LoadWalletFn load_wallet); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -279,12 +279,16 @@ std::shared_ptr CreateWallet(interfaces::Chain &chain, const std::string &name, - std::optional load_on_start, const DatabaseOptions &options, + std::optional load_on_start, DatabaseOptions &options, DatabaseStatus &status, bilingual_str &error, std::vector &warnings) { uint64_t wallet_creation_flags = options.create_flags; const SecureString &passphrase = options.create_passphrase; + if (wallet_creation_flags & WALLET_FLAG_DESCRIPTORS) { + options.require_format = DatabaseFormat::SQLITE; + } + // Indicate that the wallet is actually supposed to be blank and not just // blank to make it encrypted bool create_blank = (wallet_creation_flags & WALLET_FLAG_BLANK_WALLET); diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp --- a/src/wallet/walletutil.cpp +++ b/src/wallet/walletutil.cpp @@ -8,6 +8,7 @@ #include bool ExistsBerkeleyDatabase(const fs::path &path); +bool ExistsSQLiteDatabase(const fs::path &path); fs::path GetWalletDir() { fs::path path; @@ -51,7 +52,8 @@ const fs::path path = it->path().string().substr(offset); if (it->status().type() == fs::directory_file && - ExistsBerkeleyDatabase(it->path())) { + (ExistsBerkeleyDatabase(it->path()) || + ExistsSQLiteDatabase(it->path()))) { // Found a directory which contains wallet.dat btree file, add it as // a wallet. paths.emplace_back(path); diff --git a/test/functional/tool_wallet.py b/test/functional/tool_wallet.py --- a/test/functional/tool_wallet.py +++ b/test/functional/tool_wallet.py @@ -86,8 +86,14 @@ 'Error parsing command line arguments: Invalid parameter -foo', '-foo') locked_dir = os.path.join(self.options.tmpdir, "node0", "regtest", "wallets") + error = f'Error initializing wallet database environment "{locked_dir}"!' + if self.options.descriptors: + error = ( + "SQLiteDatabase: Unable to obtain an exclusive lock on the " + "database, is it being used by another bitcoind?" + ) self.assert_raises_tool_error( - f'Error initializing wallet database environment "{locked_dir}"!', + error, '-wallet=' + self.default_wallet_name, 'info', ) diff --git a/test/functional/wallet_descriptor.py b/test/functional/wallet_descriptor.py --- a/test/functional/wallet_descriptor.py +++ b/test/functional/wallet_descriptor.py @@ -29,7 +29,7 @@ # A descriptor wallet should have 100 addresses = 100 keys self.log.info("Checking wallet info") wallet_info = self.nodes[0].getwalletinfo() - assert_equal(wallet_info['format'], 'bdb') + assert_equal(wallet_info['format'], 'sqlite') assert_equal(wallet_info['keypoolsize'], 100) assert_equal(wallet_info['keypoolsize_hd_internal'], 100) assert 'keypoololdest' not in wallet_info