mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user