Skip to content

Commit d7637c5

Browse files
committed
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.
1 parent 5d296ac commit d7637c5

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
@@ -719,6 +719,11 @@ bool CWallet::EncryptWallet(const SecureString& strWalletPassphrase)
719719
// bits of the unencrypted private key in slack space in the database file.
720720
database->Rewrite();
721721

722+
// BDB seems to have a bad habit of writing old data into
723+
// slack space in .dat files; that is bad if the old data is
724+
// unencrypted private keys. So:
725+
database->ReloadDbEnv();
726+
722727
}
723728
NotifyStatusChanged(this);
724729

0 commit comments

Comments
 (0)