diff options
author | Andrew Chow <achow101-github@achow101.com> | 2018-02-20 16:08:36 -0500 |
---|---|---|
committer | João Barbosa <joao.paulo.barbosa@gmail.com> | 2019-03-11 13:19:56 +0000 |
commit | 048fda2a66df405cd98706612c87b59c2912c441 (patch) | |
tree | e6bc70bb683179c20d13f397a93a87f232f46260 /src | |
parent | f455979eb1b65c9822b414aa9e6b04b5c43322a0 (diff) |
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: #12493
Rebased-From: d7637c5
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/wallet.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index e86aa04d18..4bf2ec1e4e 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -760,6 +760,11 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase) // bits of the unencrypted private key in slack space in the database file. database->Rewrite(); + // BDB seems to have a bad habit of writing old data into + // slack space in .dat files; that is bad if the old data is + // unencrypted private keys. So: + database->ReloadDbEnv(); + } NotifyStatusChanged(this); |