diff options
| author | Gavin Andresen <[email protected]> | 2011-11-15 06:38:43 -0800 |
|---|---|---|
| committer | Gavin Andresen <[email protected]> | 2011-11-15 06:38:43 -0800 |
| commit | b6d11a30188d919d81fa9304eb9ad0be3c9eb4d2 (patch) | |
| tree | 81162a3112a97cc78cf4cca19339509b0b8d12ca /src/init.cpp | |
| parent | Merge pull request #631 from luke-jr/free_icons (diff) | |
| parent | add message about restarting bitcoin after encrypting wallet succesfully (diff) | |
| download | discoin-b6d11a30188d919d81fa9304eb9ad0be3c9eb4d2.tar.xz discoin-b6d11a30188d919d81fa9304eb9ad0be3c9eb4d2.zip | |
Merge pull request #635 from gavinandresen/encryptionbug
Prevent unencrypted private keys from being written to wallet.dat
Diffstat (limited to 'src/init.cpp')
| -rw-r--r-- | src/init.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/init.cpp b/src/init.cpp index d6e153285..c91c098e0 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -44,8 +44,8 @@ void Shutdown(void* parg) { static CCriticalSection cs_Shutdown; static bool fTaken; - bool fFirstThread; - CRITICAL_BLOCK(cs_Shutdown) + bool fFirstThread = false; + TRY_CRITICAL_BLOCK(cs_Shutdown) { fFirstThread = !fTaken; fTaken = true; @@ -55,9 +55,9 @@ void Shutdown(void* parg) { fShutdown = true; nTransactionsUpdated++; - DBFlush(false); + DBFlush(false, false); StopNode(); - DBFlush(true); + DBFlush(true, true); boost::filesystem::remove(GetPidFile()); UnregisterWallet(pwalletMain); delete pwalletMain; @@ -362,6 +362,12 @@ bool AppInit2(int argc, char* argv[]) strErrors += _("Error loading wallet.dat: Wallet corrupted \n"); else if (nLoadWalletRet == DB_TOO_NEW) strErrors += _("Error loading wallet.dat: Wallet requires newer version of Bitcoin \n"); + else if (nLoadWalletRet == DB_NEED_REWRITE) + { + strErrors += _("Wallet needed to be rewritten: restart Bitcoin to complete \n"); + wxMessageBox(strErrors, "Bitcoin", wxOK | wxICON_ERROR); + return false; + } else strErrors += _("Error loading wallet.dat \n"); } |