aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/walletdb.cpp
diff options
context:
space:
mode:
authorAva Chow <github@achow101.com>2024-01-02 16:36:06 -0500
committerAva Chow <github@achow101.com>2024-05-16 15:03:13 -0400
commitdd57713f6ede3d46e97ee7df87c10001b0bf4c3d (patch)
tree5745af9d8eda6a58cdfc5b59279d8a760f82f9ff /src/wallet/walletdb.cpp
parent6e50bee67d1d58aecd8a0ce8b7c3f5a7979365f5 (diff)
downloadbitcoin-dd57713f6ede3d46e97ee7df87c10001b0bf4c3d.tar.xz
Add MakeBerkeleyRODatabase
Implements MakeBerkeleyRODatabase and adds DatabaseFormat::BERKELEY_RO so that MakeDatabase can use BerkeleyRO as the backend database.
Diffstat (limited to 'src/wallet/walletdb.cpp')
-rw-r--r--src/wallet/walletdb.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index b1ce7ee4e7..ddd90939bf 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -23,6 +23,7 @@
#ifdef USE_BDB
#include <wallet/bdb.h>
#endif
+#include <wallet/migrate.h>
#ifdef USE_SQLITE
#include <wallet/sqlite.h>
#endif
@@ -1389,6 +1390,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 +1428,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);