From 0282b2126dcc1216a25417db0716a3a28489b72d Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 15 May 2023 16:14:43 -0400 Subject: [PATCH] walletdb: Remove unused CreateMockWalletDatabase This has been superseded by the MockableDatabase. Remove to avoid confusion as to which type of mock database to use for testing. --- src/wallet/walletdb.cpp | 34 ---------------------------------- src/wallet/walletdb.h | 4 ---- 2 files changed, 38 deletions(-) diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index 072357022e5..e99ac53b162 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -1262,38 +1262,4 @@ std::unique_ptr MakeDatabase(const fs::path& path, const Databas status = DatabaseStatus::FAILED_BAD_FORMAT; return nullptr; } - -/** Return object for accessing temporary in-memory database. */ -std::unique_ptr CreateMockWalletDatabase(DatabaseOptions& options) -{ - - std::optional format; - if (options.require_format) format = options.require_format; - if (!format) { -#ifdef USE_BDB - format = DatabaseFormat::BERKELEY; -#endif -#ifdef USE_SQLITE - format = DatabaseFormat::SQLITE; -#endif - } - - if (format == DatabaseFormat::SQLITE) { -#ifdef USE_SQLITE - return std::make_unique(":memory:", "", options, true); -#endif - assert(false); - } - -#ifdef USE_BDB - return std::make_unique(std::make_shared(), "", options); -#endif - assert(false); -} - -std::unique_ptr CreateMockWalletDatabase() -{ - DatabaseOptions options; - return CreateMockWalletDatabase(options); -} } // namespace wallet diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h index b2045403781..f84a89b23fd 100644 --- a/src/wallet/walletdb.h +++ b/src/wallet/walletdb.h @@ -305,10 +305,6 @@ using KeyFilterFn = std::function; //! Unserialize a given Key-Value pair and load it into the wallet bool ReadKeyValue(CWallet* pwallet, DataStream& ssKey, CDataStream& ssValue, std::string& strType, std::string& strErr, const KeyFilterFn& filter_fn = nullptr); - -/** Return object for accessing temporary in-memory database. */ -std::unique_ptr CreateMockWalletDatabase(DatabaseOptions& options); -std::unique_ptr CreateMockWalletDatabase(); } // namespace wallet #endif // BITCOIN_WALLET_WALLETDB_H