diff options
Diffstat (limited to 'src/wallet/walletdb.cpp')
-rw-r--r-- | src/wallet/walletdb.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp index b1ce7ee4e7..f34fcfc3fd 100644 --- a/src/wallet/walletdb.cpp +++ b/src/wallet/walletdb.cpp @@ -3,9 +3,7 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include <config/bitcoin-config.h> -#endif +#include <config/bitcoin-config.h> // IWYU pragma: keep #include <wallet/walletdb.h> @@ -23,6 +21,7 @@ #ifdef USE_BDB #include <wallet/bdb.h> #endif +#include <wallet/migrate.h> #ifdef USE_SQLITE #include <wallet/sqlite.h> #endif @@ -1389,6 +1388,11 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas return nullptr; } + // If BERKELEY was the format, then change the format from BERKELEY to BERKELEY_RO + if (format && options.require_format && format == DatabaseFormat::BERKELEY && options.require_format == DatabaseFormat::BERKELEY_RO) { + format = DatabaseFormat::BERKELEY_RO; + } + // A db already exists so format is set, but options also specifies the format, so make sure they agree if (format && options.require_format && format != options.require_format) { error = Untranslated(strprintf("Failed to load database path '%s'. Data is not in required format.", fs::PathToString(path))); @@ -1422,6 +1426,10 @@ std::unique_ptr<WalletDatabase> MakeDatabase(const fs::path& path, const Databas } } + if (format == DatabaseFormat::BERKELEY_RO) { + return MakeBerkeleyRODatabase(path, options, status, error); + } + #ifdef USE_BDB if constexpr (true) { return MakeBerkeleyDatabase(path, options, status, error); |