aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/db.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/db.h')
-rw-r--r--src/wallet/db.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/wallet/db.h b/src/wallet/db.h
index f6d0d54114..892c8d33c3 100644
--- a/src/wallet/db.h
+++ b/src/wallet/db.h
@@ -93,6 +93,12 @@ class CWalletDBWrapper
{
friend class CDB;
public:
+ /** Create dummy DB handle */
+ CWalletDBWrapper(): env(nullptr)
+ {
+ }
+
+ /** Create DB handle to real database */
CWalletDBWrapper(CDBEnv *env_in, const std::string &strFile_in):
env(env_in), strFile(strFile_in)
{
@@ -110,6 +116,12 @@ public:
*/
std::string GetName() const { return strFile; }
+ /** 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() { return env == nullptr; }
+
private:
/** BerkeleyDB specific */
CDBEnv *env;
@@ -186,7 +198,7 @@ protected:
bool Write(const K& key, const T& value, bool fOverwrite = true)
{
if (!pdb)
- return false;
+ return true;
if (fReadOnly)
assert(!"Write called on database in read-only mode");