mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 13:32:47 +01:00
wallet: Base backup filenames on original wallet filename
This commit is contained in:
parent
b823a4c9f6
commit
a2a5f3f0f0
@ -163,14 +163,14 @@ CDBEnv::VerifyResult CDBEnv::Verify(const std::string& strFile, recoverFunc_type
|
|||||||
bool CDB::Recover(const std::string& filename, void *callbackDataIn, bool (*recoverKVcallback)(void* callbackData, CDataStream ssKey, CDataStream ssValue), std::string& newFilename)
|
bool CDB::Recover(const std::string& filename, void *callbackDataIn, bool (*recoverKVcallback)(void* callbackData, CDataStream ssKey, CDataStream ssValue), std::string& newFilename)
|
||||||
{
|
{
|
||||||
// Recovery procedure:
|
// Recovery procedure:
|
||||||
// move wallet file to wallet.timestamp.bak
|
// move wallet file to walletfilename.timestamp.bak
|
||||||
// Call Salvage with fAggressive=true to
|
// Call Salvage with fAggressive=true to
|
||||||
// get as much data as possible.
|
// get as much data as possible.
|
||||||
// Rewrite salvaged data to fresh wallet file
|
// Rewrite salvaged data to fresh wallet file
|
||||||
// Set -rescan so any missing transactions will be
|
// Set -rescan so any missing transactions will be
|
||||||
// found.
|
// found.
|
||||||
int64_t now = GetTime();
|
int64_t now = GetTime();
|
||||||
newFilename = strprintf("wallet.%d.bak", now);
|
newFilename = strprintf("%s.%d.bak", filename, now);
|
||||||
|
|
||||||
int result = bitdb.dbenv->dbrename(NULL, filename.c_str(), NULL,
|
int result = bitdb.dbenv->dbrename(NULL, filename.c_str(), NULL,
|
||||||
newFilename.c_str(), DB_AUTO_COMMIT);
|
newFilename.c_str(), DB_AUTO_COMMIT);
|
||||||
|
Loading…
Reference in New Issue
Block a user