diff --git a/src/wallet/bdb.h b/src/wallet/bdb.h --- a/src/wallet/bdb.h +++ b/src/wallet/bdb.h @@ -95,8 +95,7 @@ */ class BerkeleyDatabase : public WalletDatabase { public: - /** Create dummy DB handle */ - BerkeleyDatabase() : WalletDatabase(), env(nullptr) {} + BerkeleyDatabase() = delete; /** Create DB handle to real database */ BerkeleyDatabase(std::shared_ptr envIn, @@ -183,14 +182,6 @@ /** Make a BerkeleyBatch connected to this database */ std::unique_ptr MakeBatch(const char *mode = "r+", bool flush_on_close = true) override; - -private: - /** - * Return whether this database handle is a dummy for testing. - * Only to be used at a low level, application should ideally not care - * about this. - */ - bool IsDummy() const { return env == nullptr; } }; /** RAII class that provides access to a Berkeley database */ diff --git a/src/wallet/bdb.cpp b/src/wallet/bdb.cpp --- a/src/wallet/bdb.cpp +++ b/src/wallet/bdb.cpp @@ -362,10 +362,6 @@ } void BerkeleyDatabase::Open(const char *pszMode) { - if (IsDummy()) { - return; - } - bool fCreate = strchr(pszMode, 'c') != nullptr; unsigned int nFlags = DB_THREAD; if (fCreate) { @@ -512,9 +508,6 @@ } bool BerkeleyDatabase::Rewrite(const char *pszSkip) { - if (IsDummy()) { - return true; - } while (true) { { LOCK(cs_db); @@ -673,11 +666,6 @@ } bool BerkeleyDatabase::PeriodicFlush() { - // There's nothing to do for dummy databases. Return true. - if (IsDummy()) { - return true; - } - // Don't flush if we can't acquire the lock. TRY_LOCK(cs_db, lockDb); if (!lockDb) { @@ -711,9 +699,6 @@ } bool BerkeleyDatabase::Backup(const std::string &strDest) const { - if (IsDummy()) { - return false; - } while (true) { { LOCK(cs_db); @@ -753,21 +738,15 @@ } void BerkeleyDatabase::Flush() { - if (!IsDummy()) { - env->Flush(false); - } + env->Flush(false); } void BerkeleyDatabase::Close() { - if (!IsDummy()) { - env->Flush(true); - } + env->Flush(true); } void BerkeleyDatabase::ReloadDbEnv() { - if (!IsDummy()) { - env->ReloadDbEnv(); - } + env->ReloadDbEnv(); } bool BerkeleyBatch::StartCursor() {