Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/bdb.cpp
Show First 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | |||||
BerkeleyBatch::SafeDbt::operator Dbt *() { | BerkeleyBatch::SafeDbt::operator Dbt *() { | ||||
return &m_dbt; | return &m_dbt; | ||||
} | } | ||||
bool BerkeleyDatabase::Verify(bilingual_str &errorStr) { | bool BerkeleyDatabase::Verify(bilingual_str &errorStr) { | ||||
fs::path walletDir = env->Directory(); | fs::path walletDir = env->Directory(); | ||||
fs::path file_path = walletDir / strFile; | fs::path file_path = walletDir / strFile; | ||||
LogPrintf("Using BerkeleyDB version %s\n", | LogPrintf("Using BerkeleyDB version %s\n", BerkeleyDatabaseVersion()); | ||||
DbEnv::version(nullptr, nullptr, nullptr)); | |||||
LogPrintf("Using wallet %s\n", file_path.string()); | LogPrintf("Using wallet %s\n", file_path.string()); | ||||
if (!env->Open(errorStr)) { | if (!env->Open(errorStr)) { | ||||
return false; | return false; | ||||
} | } | ||||
if (fs::exists(file_path)) { | if (fs::exists(file_path)) { | ||||
assert(m_refcount == 0); | assert(m_refcount == 0); | ||||
▲ Show 20 Lines • Show All 510 Lines • ▼ Show 20 Lines | bool BerkeleyBatch::TxnAbort() { | ||||
if (!pdb || !activeTxn) { | if (!pdb || !activeTxn) { | ||||
return false; | return false; | ||||
} | } | ||||
int ret = activeTxn->abort(); | int ret = activeTxn->abort(); | ||||
activeTxn = nullptr; | activeTxn = nullptr; | ||||
return (ret == 0); | return (ret == 0); | ||||
} | } | ||||
std::string BerkeleyDatabaseVersion() { | |||||
return DbEnv::version(nullptr, nullptr, nullptr); | |||||
} | |||||
bool BerkeleyBatch::ReadKey(CDataStream &&key, CDataStream &value) { | bool BerkeleyBatch::ReadKey(CDataStream &&key, CDataStream &value) { | ||||
if (!pdb) { | if (!pdb) { | ||||
return false; | return false; | ||||
} | } | ||||
SafeDbt datKey(key.data(), key.size()); | SafeDbt datKey(key.data(), key.size()); | ||||
SafeDbt datValue; | SafeDbt datValue; | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |