Skip to content

Commit

Permalink
After encrypting the wallet, reload the database environment
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
achow101 committed Aug 9, 2018
1 parent 5d296ac commit d7637c5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,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);

Expand Down

0 comments on commit d7637c5

Please sign in to comment.