mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Move AutoBackup initialization into CWallet::InitAutoBackup
This commit is contained in:
parent
205ff3519e
commit
9b1d1c61b2
16
src/init.cpp
16
src/init.cpp
@ -1241,20 +1241,8 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||
|
||||
// ********************************************************* Step 5: Backup wallet and verify wallet database integrity
|
||||
#ifdef ENABLE_WALLET
|
||||
std::string strWarning;
|
||||
std::string strError;
|
||||
|
||||
nWalletBackups = GetArg("-createwalletbackups", 10);
|
||||
nWalletBackups = std::max(0, std::min(10, nWalletBackups));
|
||||
|
||||
std::string strWalletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
|
||||
|
||||
if(!AutoBackupWallet(NULL, strWalletFile, strWarning, strError)) {
|
||||
if (!strWarning.empty())
|
||||
InitWarning(strWarning);
|
||||
if (!strError.empty())
|
||||
return InitError(strError);
|
||||
}
|
||||
if (!CWallet::InitAutoBackup())
|
||||
return false;
|
||||
|
||||
if (!CWallet::Verify())
|
||||
return false;
|
||||
|
@ -4840,6 +4840,29 @@ bool CWallet::ParameterInteraction()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CWallet::InitAutoBackup()
|
||||
{
|
||||
if (GetBoolArg("-disablewallet", DEFAULT_DISABLE_WALLET))
|
||||
return true;
|
||||
|
||||
std::string strWarning;
|
||||
std::string strError;
|
||||
|
||||
nWalletBackups = GetArg("-createwalletbackups", 10);
|
||||
nWalletBackups = std::max(0, std::min(10, nWalletBackups));
|
||||
|
||||
std::string strWalletFile = GetArg("-wallet", DEFAULT_WALLET_DAT);
|
||||
|
||||
if(!AutoBackupWallet(NULL, strWalletFile, strWarning, strError)) {
|
||||
if (!strWarning.empty())
|
||||
InitWarning(strWarning);
|
||||
if (!strError.empty())
|
||||
return InitError(strError);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CWallet::BackupWallet(const std::string& strDest)
|
||||
{
|
||||
if (!fFileBacked)
|
||||
|
@ -1042,6 +1042,9 @@ public:
|
||||
/* Wallets parameter interaction */
|
||||
static bool ParameterInteraction();
|
||||
|
||||
/* Initialize AutoBackup functionality */
|
||||
static bool InitAutoBackup();
|
||||
|
||||
bool BackupWallet(const std::string& strDest);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user