diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2012-10-05 19:26:54 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2012-10-08 17:46:46 -0400 |
commit | d0b3e77a084ecffae35961994fc0964b37a79f04 (patch) | |
tree | 73277d9f4ba2a55a0ee4a0fa8221279710362af5 /src | |
parent | eed1785f701be93ac2464e854c2a7de1f748ef84 (diff) |
Don't try to verify a non-existent wallet.dat
Diffstat (limited to 'src')
-rw-r--r-- | src/init.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/init.cpp b/src/init.cpp index 480d65422c..2141e196a0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -507,17 +507,20 @@ bool AppInit2() 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); - } - if (r == CDBEnv::RECOVER_FAIL) - return InitError(_("wallet.dat corrupt, salvage failed")); + 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")); + } // ********************************************************* Step 6: network initialization |