diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-03-08 12:08:26 +0000 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2017-04-20 17:15:31 +0200 |
commit | 071c95570b8e2ee5c2a4aed8b86b9b14f8e75578 (patch) | |
tree | 221b1970c08d70f77b433ca0fc1b3a6457c79f49 /src/wallet/db.cpp | |
parent | 71afe3c0995592ff17968816a833a8ed3ce05bf2 (diff) |
wallet: Get rid of fFileBacked
Instead, CWalletDB() with a dummy handle will just give you a no-op
database in which writes always succeeds and reads always fail. CDB
already had functionality for this, so just use that.
Diffstat (limited to 'src/wallet/db.cpp')
-rw-r--r-- | src/wallet/db.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index cdf785a957..0ea4ea3673 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -364,7 +364,10 @@ CDB::CDB(CWalletDBWrapper& dbw, const char* pszMode, bool fFlushOnCloseIn) : pdb int ret; fReadOnly = (!strchr(pszMode, '+') && !strchr(pszMode, 'w')); fFlushOnClose = fFlushOnCloseIn; - const std::string& strFilename = dbw.strFile; + if (dbw.IsDummy()) { + return; + } + const std::string &strFilename = dbw.strFile; bool fCreate = strchr(pszMode, 'c') != NULL; unsigned int nFlags = DB_THREAD; @@ -473,7 +476,7 @@ bool CDBEnv::RemoveDb(const std::string& strFile) bool CDB::Rewrite(CWalletDBWrapper& dbw, const char* pszSkip) { - if (!dbw.env) { + if (dbw.IsDummy()) { return true; } const std::string& strFile = dbw.strFile; @@ -601,6 +604,9 @@ void CDBEnv::Flush(bool fShutdown) bool CDB::PeriodicFlush(CWalletDBWrapper& dbw) { + if (dbw.IsDummy()) { + return true; + } bool ret = false; const std::string& strFile = dbw.strFile; TRY_LOCK(bitdb.cs_db,lockDb); @@ -645,7 +651,7 @@ bool CWalletDBWrapper::Rewrite(const char* pszSkip) bool CWalletDBWrapper::Backup(const std::string& strDest) { - if (!env) { + if (IsDummy()) { return false; } while (true) |