From b82f0ca4d5465b36debb6c57f335bdccf4899c49 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 15 Jun 2020 16:54:58 -0400 Subject: walletdb: Add MakeBatch function to BerkeleyDatabase and use it Instead of having WalletBatch construct the BerkeleyBatch, have BerkeleyDatabase do it and return a std::unique_ptr --- src/wallet/bdb.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/wallet/bdb.h') diff --git a/src/wallet/bdb.h b/src/wallet/bdb.h index f3b1e5d0a3..b565bfc680 100644 --- a/src/wallet/bdb.h +++ b/src/wallet/bdb.h @@ -93,6 +93,8 @@ std::shared_ptr GetWalletEnv(const fs::path& wallet_path, s /** Return wheter a BDB wallet database is currently loaded. */ bool IsBDBWalletLoaded(const fs::path& wallet_path); +class BerkeleyBatch; + /** An instance of this class represents one database. * For BerkeleyDB this is just a (env, strFile) tuple. **/ @@ -161,6 +163,9 @@ public: /** Database pointer. This is initialized lazily and reset during flushes, so it can be null. */ std::unique_ptr m_db; + /** Make a BerkeleyBatch connected to this database */ + std::unique_ptr MakeBatch(const char* mode, bool flush_on_close); + private: std::string strFile; -- cgit v1.2.3