aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/bdb.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2020-10-14 14:08:09 +0200
committerWladimir J. van der Laan <laanwj@protonmail.com>2020-10-14 14:50:22 +0200
commit9efa55c715c0179b2bd079348ef67b624411b11b (patch)
treeee5db9ad772f43e20705c0804acfdcf125a9ee3c /src/wallet/bdb.h
parent3750f664b349c759e715ba0b9e1a64e1ea07c782 (diff)
parent135afa749c6e835ea33b8678cdb35da9640eede8 (diff)
Merge #20130: Wallet: remove db mode string
135afa749c6e835ea33b8678cdb35da9640eede8 wallet: remove db mode string (Ivan Metlushko) Pull request description: This is a [follow-up](https://github.com/bitcoin/bitcoin/pull/19077#discussion_r500261927) for #19077 This PR simplifies DB interface by removing mode string from `WalletDatabase` and `WalletBatch`. The mode string was used to determine two flags for the instantiation of db connection: 1) read-only flag. Never used on connection level. And on batch level Is only used within `BerkeleyDatabase::Rewrite` where it's replaced with bool flag. 2) create flag. Is not required as we always check `require_existing` & `require_create` flags in `MakeDatabase()` before creating actual database instance. So we can safely default to always creating database if it doesn't exist yet. ACKs for top commit: achow101: ACK 135afa749c6e835ea33b8678cdb35da9640eede8 laanwj: Code review ACK 135afa749c6e835ea33b8678cdb35da9640eede8 Tree-SHA512: f49c07c7387c02e517a58199620a678a918f8dfc20d1347d29fd6adea0bc89698c26cb8eef42b0977961c11c207c4bbe109bc31059f47c126cc600b01fd987eb
Diffstat (limited to 'src/wallet/bdb.h')
-rw-r--r--src/wallet/bdb.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/wallet/bdb.h b/src/wallet/bdb.h
index fd5a49acc3..070590872b 100644
--- a/src/wallet/bdb.h
+++ b/src/wallet/bdb.h
@@ -109,9 +109,8 @@ public:
~BerkeleyDatabase() override;
- /** Open the database if it is not already opened.
- * Dummy function, doesn't do anything right now, but is needed for class abstraction */
- void Open(const char* mode) override;
+ /** Open the database if it is not already opened. */
+ void Open() override;
/** Rewrite the entire database on disk, with the exception of key pszSkip if non-zero
*/
@@ -164,7 +163,7 @@ public:
std::string strFile;
/** Make a BerkeleyBatch connected to this database */
- std::unique_ptr<DatabaseBatch> MakeBatch(const char* mode = "r+", bool flush_on_close = true) override;
+ std::unique_ptr<DatabaseBatch> MakeBatch(bool flush_on_close = true) override;
};
/** RAII class that provides access to a Berkeley database */
@@ -207,7 +206,7 @@ protected:
BerkeleyDatabase& m_database;
public:
- explicit BerkeleyBatch(BerkeleyDatabase& database, const char* pszMode = "r+", bool fFlushOnCloseIn=true);
+ explicit BerkeleyBatch(BerkeleyDatabase& database, const bool fReadOnly, bool fFlushOnCloseIn=true);
~BerkeleyBatch() override;
BerkeleyBatch(const BerkeleyBatch&) = delete;