aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/db.h
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-01-03 13:21:44 +0100
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-01-26 10:44:05 +0100
commitfa29e73cdab82f98682821322cda89b1084ba887 (patch)
treefd765bb960156a69445818bdd6dfd6930cf733ae /src/wallet/db.h
parentfa9becfe1cea5040e7cea36324d1b0789cbbd25d (diff)
downloadbitcoin-fa29e73cdab82f98682821322cda89b1084ba887.tar.xz
Use DataStream where possible
Diffstat (limited to 'src/wallet/db.h')
-rw-r--r--src/wallet/db.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/wallet/db.h b/src/wallet/db.h
index d040af0d14..287fb1d19e 100644
--- a/src/wallet/db.h
+++ b/src/wallet/db.h
@@ -38,17 +38,17 @@ public:
DONE,
};
- virtual Status Next(CDataStream& key, CDataStream& value) { return Status::FAIL; }
+ virtual Status Next(DataStream& key, DataStream& value) { return Status::FAIL; }
};
/** RAII class that provides access to a WalletDatabase */
class DatabaseBatch
{
private:
- virtual bool ReadKey(CDataStream&& key, CDataStream& value) = 0;
- virtual bool WriteKey(CDataStream&& key, CDataStream&& value, bool overwrite=true) = 0;
- virtual bool EraseKey(CDataStream&& key) = 0;
- virtual bool HasKey(CDataStream&& key) = 0;
+ virtual bool ReadKey(DataStream&& key, DataStream& value) = 0;
+ virtual bool WriteKey(DataStream&& key, DataStream&& value, bool overwrite = true) = 0;
+ virtual bool EraseKey(DataStream&& key) = 0;
+ virtual bool HasKey(DataStream&& key) = 0;
public:
explicit DatabaseBatch() {}
@@ -63,7 +63,7 @@ public:
template <typename K, typename T>
bool Read(const K& key, T& value)
{
- CDataStream ssKey(SER_DISK, CLIENT_VERSION);
+ DataStream ssKey{};
ssKey.reserve(1000);
ssKey << key;
@@ -80,7 +80,7 @@ public:
template <typename K, typename T>
bool Write(const K& key, const T& value, bool fOverwrite = true)
{
- CDataStream ssKey(SER_DISK, CLIENT_VERSION);
+ DataStream ssKey{};
ssKey.reserve(1000);
ssKey << key;
@@ -94,7 +94,7 @@ public:
template <typename K>
bool Erase(const K& key)
{
- CDataStream ssKey(SER_DISK, CLIENT_VERSION);
+ DataStream ssKey{};
ssKey.reserve(1000);
ssKey << key;
@@ -104,7 +104,7 @@ public:
template <typename K>
bool Exists(const K& key)
{
- CDataStream ssKey(SER_DISK, CLIENT_VERSION);
+ DataStream ssKey{};
ssKey.reserve(1000);
ssKey << key;
@@ -175,17 +175,17 @@ public:
class DummyCursor : public DatabaseCursor
{
- Status Next(CDataStream& key, CDataStream& value) override { return Status::FAIL; }
+ 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(CDataStream&& key, CDataStream& value) override { return true; }
- bool WriteKey(CDataStream&& key, CDataStream&& value, bool overwrite=true) override { return true; }
- bool EraseKey(CDataStream&& key) override { return true; }
- bool HasKey(CDataStream&& key) override { return true; }
+ 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; }
public:
void Flush() override {}