Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/db.cpp
Show First 20 Lines • Show All 338 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/* End of headers, beginning of key/value data */ | /* End of headers, beginning of key/value data */ | ||||
static const char *HEADER_END = "HEADER=END"; | static const char *HEADER_END = "HEADER=END"; | ||||
/* End of key/value data */ | /* End of key/value data */ | ||||
static const char *DATA_END = "DATA=END"; | static const char *DATA_END = "DATA=END"; | ||||
typedef std::pair<std::vector<uint8_t>, std::vector<uint8_t>> KeyValPair; | typedef std::pair<std::vector<uint8_t>, std::vector<uint8_t>> KeyValPair; | ||||
bool BerkeleyBatch::Recover(const fs::path &file_path, void *callbackDataIn, | bool RecoverDatabaseFile(const fs::path &file_path, void *callbackDataIn, | ||||
bool (*recoverKVcallback)(void *callbackData, | bool (*recoverKVcallback)(void *callbackData, | ||||
CDataStream ssKey, | CDataStream ssKey, | ||||
CDataStream ssValue), | CDataStream ssValue), | ||||
std::string &newFilename) { | std::string &newFilename) { | ||||
std::string filename; | std::string filename; | ||||
std::shared_ptr<BerkeleyEnvironment> env = | std::shared_ptr<BerkeleyEnvironment> env = | ||||
GetWalletEnv(file_path, filename); | GetWalletEnv(file_path, filename); | ||||
// Recovery procedure: | // Recovery procedure: | ||||
// Move wallet file to walletfilename.timestamp.bak | // Move wallet file to walletfilename.timestamp.bak | ||||
// Call Salvage with fAggressive=true to get as much data as possible. | // Call Salvage with fAggressive=true to get as much data as possible. | ||||
// Rewrite salvaged data to fresh wallet file. | // Rewrite salvaged data to fresh wallet file. | ||||
▲ Show 20 Lines • Show All 621 Lines • Show Last 20 Lines |