Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/db.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
Lint: Code style violation: '/home/george/Documents/Git/bitcoin-abc/src/wallet/db.cpp' has code style errors. | |||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include "db.h" | #include "db.h" | ||||
#include "addrman.h" | #include "addrman.h" | ||||
#include "hash.h" | #include "hash.h" | ||||
▲ Show 20 Lines • Show All 211 Lines • ▼ Show 20 Lines | void CDBEnv::CheckpointLSN(const std::string &strFile) { | ||||
dbenv->txn_checkpoint(0, 0, 0); | dbenv->txn_checkpoint(0, 0, 0); | ||||
if (fMockDb) return; | if (fMockDb) return; | ||||
dbenv->lsn_reset(strFile.c_str(), 0); | dbenv->lsn_reset(strFile.c_str(), 0); | ||||
} | } | ||||
CDB::CDB(const std::string &strFilename, const char *pszMode, | CDB::CDB(const std::string &strFilename, const char *pszMode, | ||||
bool fFlushOnCloseIn) | bool fFlushOnCloseIn) | ||||
: pdb(nullptr), activeTxn(nullptr) { | : pdb(nullptr), activeTxn(nullptr) { | ||||
int ret; | |||||
fReadOnly = (!strchr(pszMode, '+') && !strchr(pszMode, 'w')); | fReadOnly = (!strchr(pszMode, '+') && !strchr(pszMode, 'w')); | ||||
fFlushOnClose = fFlushOnCloseIn; | fFlushOnClose = fFlushOnCloseIn; | ||||
if (strFilename.empty()) return; | if (strFilename.empty()) return; | ||||
bool fCreate = strchr(pszMode, 'c') != nullptr; | bool fCreate = strchr(pszMode, 'c') != nullptr; | ||||
unsigned int nFlags = DB_THREAD; | unsigned int nFlags = DB_THREAD; | ||||
if (fCreate) nFlags |= DB_CREATE; | if (fCreate) nFlags |= DB_CREATE; | ||||
{ | { | ||||
int ret; | |||||
LOCK(bitdb.cs_db); | LOCK(bitdb.cs_db); | ||||
if (!bitdb.Open(GetDataDir())) | if (!bitdb.Open(GetDataDir())) | ||||
throw std::runtime_error("CDB: Failed to open database environment."); | throw std::runtime_error("CDB: Failed to open database environment."); | ||||
strFile = strFilename; | strFile = strFilename; | ||||
++bitdb.mapFileUseCount[strFile]; | ++bitdb.mapFileUseCount[strFile]; | ||||
pdb = bitdb.mapDb[strFile]; | pdb = bitdb.mapDb[strFile]; | ||||
if (pdb == nullptr) { | if (pdb == nullptr) { | ||||
▲ Show 20 Lines • Show All 218 Lines • Show Last 20 Lines |
'/home/george/Documents/Git/bitcoin-abc/src/wallet/db.cpp' has code style errors.