Skip to content

Commit 048fda2

Browse files
achow101promag
authored andcommitted
After encrypting the wallet, reload the database environment
Calls ReloadDbEnv after encrypting the wallet so that the database environment is flushed, closed, and reopened to prevent unencrypted keys from being saved on disk. Github-Pull: bitcoin#12493 Rebased-From: d7637c5
1 parent f455979 commit 048fda2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/wallet/wallet.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,11 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
760760
// bits of the unencrypted private key in slack space in the database file.
761761
database->Rewrite();
762762

763+
// BDB seems to have a bad habit of writing old data into
764+
// slack space in .dat files; that is bad if the old data is
765+
// unencrypted private keys. So:
766+
database->ReloadDbEnv();
767+
763768
}
764769
NotifyStatusChanged(this);
765770

0 commit comments

Comments
 (0)