Mercurial > hg > bitcoin
changeset 3605:2cb16bc89cda draft
Don't try to verify a non-existent wallet.dat
author | Gavin Andresen <gavinandresen@gmail.com> |
---|---|
date | Fri, 05 Oct 2012 19:26:54 -0400 |
parents | fbf468eac50a |
children | e34485ae790c |
files | src/init.cpp |
diffstat | 1 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/init.cpp +++ b/src/init.cpp @@ -507,17 +507,20 @@ return false; } - CDBEnv::VerifyResult r = bitdb.Verify("wallet.dat", CWalletDB::Recover); - if (r == CDBEnv::RECOVER_OK) + if (filesystem::exists(GetDataDir() / "wallet.dat")) { - string msg = strprintf(_("Warning: wallet.dat corrupt, data salvaged!" - " Original wallet.dat saved as wallet.{timestamp}.bak in %s; if" - " your balance or transactions are incorrect you should" - " restore from a backup."), pszDataDir); - uiInterface.ThreadSafeMessageBox(msg, _("Bitcoin"), CClientUIInterface::OK | CClientUIInterface::ICON_EXCLAMATION | CClientUIInterface::MODAL); + CDBEnv::VerifyResult r = bitdb.Verify("wallet.dat", CWalletDB::Recover); + if (r == CDBEnv::RECOVER_OK) + { + string msg = strprintf(_("Warning: wallet.dat corrupt, data salvaged!" + " Original wallet.dat saved as wallet.{timestamp}.bak in %s; if" + " your balance or transactions are incorrect you should" + " restore from a backup."), pszDataDir); + uiInterface.ThreadSafeMessageBox(msg, _("Bitcoin"), CClientUIInterface::OK | CClientUIInterface::ICON_EXCLAMATION | CClientUIInterface::MODAL); + } + if (r == CDBEnv::RECOVER_FAIL) + return InitError(_("wallet.dat corrupt, salvage failed")); } - if (r == CDBEnv::RECOVER_FAIL) - return InitError(_("wallet.dat corrupt, salvage failed")); // ********************************************************* Step 6: network initialization