Only remove database log files on shutdown after wallet encryption/rewrite

This commit is contained in:
Gavin Andresen
2011-11-17 14:21:32 -05:00
committed by Luke Dashjr
parent 90de05e88e
commit c4a3bf9e55
4 changed files with 16 additions and 9 deletions

View File

@@ -194,8 +194,8 @@ bool CWallet::EncryptWallet(const string& strWalletPassphrase)
// Need to completely rewrite the wallet file; if we don't, bdb might keep
// bits of the unencrypted private key in slack space in the database file.
setKeyPool.clear();
CDB::Rewrite(strWalletFile);
if (CDB::Rewrite(strWalletFile))
RemoveLogFilesOnShutdown(true);
}
return true;
@@ -1134,6 +1134,7 @@ int CWallet::LoadWallet(bool& fFirstRunRet)
{
if (CDB::Rewrite(strWalletFile, "\x04pool"))
{
RemoveLogFilesOnShutdown(true);
setKeyPool.clear();
// Note: can't top-up keypool here, because wallet is locked.
// User will be prompted to unlock wallet the next operation