Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/walletdb.cpp
Show First 20 Lines • Show All 781 Lines • ▼ Show 20 Lines | void MaybeCompactWalletDB() { | ||||
} | } | ||||
fOneThread = false; | fOneThread = false; | ||||
} | } | ||||
// | // | ||||
// Try to (very carefully!) recover wallet file if there is a problem. | // Try to (very carefully!) recover wallet file if there is a problem. | ||||
// | // | ||||
bool CWalletDB::Recover(const std::string &filename, void *callbackDataIn, | bool CWalletDB::Recover(const fs::path &wallet_path, void *callbackDataIn, | ||||
bool (*recoverKVcallback)(void *callbackData, | bool (*recoverKVcallback)(void *callbackData, | ||||
CDataStream ssKey, | CDataStream ssKey, | ||||
CDataStream ssValue), | CDataStream ssValue), | ||||
std::string &out_backup_filename) { | std::string &out_backup_filename) { | ||||
return CDB::Recover(filename, callbackDataIn, recoverKVcallback, | return CDB::Recover(wallet_path, callbackDataIn, recoverKVcallback, | ||||
out_backup_filename); | out_backup_filename); | ||||
} | } | ||||
bool CWalletDB::Recover(const std::string &filename, | bool CWalletDB::Recover(const fs::path &wallet_path, | ||||
std::string &out_backup_filename) { | std::string &out_backup_filename) { | ||||
// recover without a key filter callback | // recover without a key filter callback | ||||
// results in recovering all record types | // results in recovering all record types | ||||
return CWalletDB::Recover(filename, nullptr, nullptr, out_backup_filename); | return CWalletDB::Recover(wallet_path, nullptr, nullptr, | ||||
out_backup_filename); | |||||
} | } | ||||
bool CWalletDB::RecoverKeysOnlyFilter(void *callbackData, CDataStream ssKey, | bool CWalletDB::RecoverKeysOnlyFilter(void *callbackData, CDataStream ssKey, | ||||
CDataStream ssValue) { | CDataStream ssValue) { | ||||
CWallet *dummyWallet = reinterpret_cast<CWallet *>(callbackData); | CWallet *dummyWallet = reinterpret_cast<CWallet *>(callbackData); | ||||
CWalletScanState dummyWss; | CWalletScanState dummyWss; | ||||
std::string strType, strErr; | std::string strType, strErr; | ||||
bool fReadOK; | bool fReadOK; | ||||
Show All 10 Lines | if (!fReadOK) { | ||||
LogPrintf("WARNING: CWalletDB::Recover skipping %s: %s\n", strType, | LogPrintf("WARNING: CWalletDB::Recover skipping %s: %s\n", strType, | ||||
strErr); | strErr); | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
bool CWalletDB::VerifyEnvironment(const std::string &walletFile, | bool CWalletDB::VerifyEnvironment(const fs::path &wallet_path, | ||||
const fs::path &walletDir, | |||||
std::string &errorStr) { | std::string &errorStr) { | ||||
return CDB::VerifyEnvironment(walletFile, walletDir, errorStr); | return CDB::VerifyEnvironment(wallet_path, errorStr); | ||||
} | } | ||||
bool CWalletDB::VerifyDatabaseFile(const std::string &walletFile, | bool CWalletDB::VerifyDatabaseFile(const fs::path &wallet_path, | ||||
const fs::path &walletDir, | |||||
std::string &warningStr, | std::string &warningStr, | ||||
std::string &errorStr) { | std::string &errorStr) { | ||||
return CDB::VerifyDatabaseFile(walletFile, walletDir, warningStr, errorStr, | return CDB::VerifyDatabaseFile(wallet_path, warningStr, errorStr, | ||||
CWalletDB::Recover); | CWalletDB::Recover); | ||||
} | } | ||||
bool CWalletDB::WriteDestData(const CTxDestination &address, | bool CWalletDB::WriteDestData(const CTxDestination &address, | ||||
const std::string &key, | const std::string &key, | ||||
const std::string &value) { | const std::string &value) { | ||||
if (!IsValidDestination(address)) { | if (!IsValidDestination(address)) { | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |