aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/bdb.h
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2020-08-04 16:40:31 -0400
committerRussell Yanofsky <russ@yanofsky.org>2020-09-03 12:24:32 -0400
commitb5b414151af32e5a07b5757b64482d77519d77c0 (patch)
treec6149426f3c4e7c72507db59d59b62d2ecb774b6 /src/wallet/bdb.h
parent288b4ffb6b291f0466d513ff3c40af6758ca7c88 (diff)
downloadbitcoin-b5b414151af32e5a07b5757b64482d77519d77c0.tar.xz
wallet: Add MakeDatabase function
New function is not currently called but will be called in upcoming commits. It moves database path checking, and existence checking, and already-loaded checking, and verification into a single function so this logic does not need to be repeated all over higher level wallet code, and so higher level code does not need to change when SQLite support is added in https://github.com/bitcoin/bitcoin/pull/19077. This also lets higher level wallet code make fewer assumptions about the contents of wallet directories. This commit just adds the new function and does not change behavior in any way.
Diffstat (limited to 'src/wallet/bdb.h')
-rw-r--r--src/wallet/bdb.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wallet/bdb.h b/src/wallet/bdb.h
index 75546924e8..82ad136649 100644
--- a/src/wallet/bdb.h
+++ b/src/wallet/bdb.h
@@ -90,6 +90,9 @@ std::shared_ptr<BerkeleyEnvironment> GetWalletEnv(const fs::path& wallet_path, s
/** Return whether a BDB wallet database is currently loaded. */
bool IsBDBWalletLoaded(const fs::path& wallet_path);
+/** Check format of database file */
+bool IsBerkeleyBtree(const fs::path& path);
+
class BerkeleyBatch;
/** An instance of this class represents one database.
@@ -224,4 +227,10 @@ public:
std::string BerkeleyDatabaseVersion();
+//! Check if Berkeley database exists at specified path.
+bool ExistsBerkeleyDatabase(const fs::path& path);
+
+//! Return object giving access to Berkeley database at specified path.
+std::unique_ptr<BerkeleyDatabase> MakeBerkeleyDatabase(const fs::path& path, const DatabaseOptions& options, DatabaseStatus& status, bilingual_str& error);
+
#endif // BITCOIN_WALLET_BDB_H