Skip to content
Permalink
Browse files

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
  • Loading branch information...
achow101 authored and promag committed Feb 20, 2018
1 parent f455979 commit 048fda2a66df405cd98706612c87b59c2912c441
Showing with 5 additions and 0 deletions.
  1. +5 −0 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);

0 comments on commit 048fda2

Please sign in to comment.
You can’t perform that action at this time.