aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/db.h
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2022-12-12 15:43:00 -0500
committerAndrew Chow <github@achow101.com>2023-05-03 10:45:10 -0400
commit14aa4cb1e44f089a6022a2b14a98bca4a7dd9a01 (patch)
tree8797a6e8f5f1ff356f7831781ed38f991b5ba674 /src/wallet/db.h
parentf67a385556c60b2e4788a378196a395fca0539f5 (diff)
downloadbitcoin-14aa4cb1e44f089a6022a2b14a98bca4a7dd9a01.tar.xz
wallet: Move DummyDatabase to salvage
It's only used by salvage, so make it local to that only.
Diffstat (limited to 'src/wallet/db.h')
-rw-r--r--src/wallet/db.h45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/wallet/db.h b/src/wallet/db.h
index 6834ba6963..b4ccd13a9a 100644
--- a/src/wallet/db.h
+++ b/src/wallet/db.h
@@ -174,51 +174,6 @@ public:
virtual std::unique_ptr<DatabaseBatch> MakeBatch(bool flush_on_close = true) = 0;
};
-class DummyCursor : public DatabaseCursor
-{
- Status Next(DataStream& key, DataStream& value) override { return Status::FAIL; }
-};
-
-/** RAII class that provides access to a DummyDatabase. Never fails. */
-class DummyBatch : public DatabaseBatch
-{
-private:
- bool ReadKey(DataStream&& key, DataStream& value) override { return true; }
- bool WriteKey(DataStream&& key, DataStream&& value, bool overwrite = true) override { return true; }
- bool EraseKey(DataStream&& key) override { return true; }
- bool HasKey(DataStream&& key) override { return true; }
- bool ErasePrefix(Span<const std::byte> prefix) override { return true; }
-
-public:
- void Flush() override {}
- void Close() override {}
-
- std::unique_ptr<DatabaseCursor> GetNewCursor() override { return std::make_unique<DummyCursor>(); }
- bool TxnBegin() override { return true; }
- bool TxnCommit() override { return true; }
- bool TxnAbort() override { return true; }
-};
-
-/** A dummy WalletDatabase that does nothing and never fails. Only used by unit tests.
- **/
-class DummyDatabase : public WalletDatabase
-{
-public:
- void Open() override {};
- void AddRef() override {}
- void RemoveRef() override {}
- bool Rewrite(const char* pszSkip=nullptr) override { return true; }
- bool Backup(const std::string& strDest) const override { return true; }
- void Close() override {}
- void Flush() override {}
- bool PeriodicFlush() override { return true; }
- void IncrementUpdateCounter() override { ++nUpdateCounter; }
- void ReloadDbEnv() override {}
- std::string Filename() override { return "dummy"; }
- std::string Format() override { return "dummy"; }
- std::unique_ptr<DatabaseBatch> MakeBatch(bool flush_on_close = true) override { return std::make_unique<DummyBatch>(); }
-};
-
enum class DatabaseFormat {
BERKELEY,
SQLITE,