aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet.cpp
diff options
context:
space:
mode:
authorAndrew Chow <[email protected]>2018-02-20 16:08:36 -0500
committerAndrew Chow <[email protected]>2018-08-09 11:27:39 -0700
commitd7637c5a3f1d62922594cdfb6272e30dacf60ce9 (patch)
tree7b1647fd1c1e26914c1a7a41a7e37ee055df9ce4 /src/wallet/wallet.cpp
parentAdd function to close all Db's and reload the databae environment (diff)
downloaddiscoin-d7637c5a3f1d62922594cdfb6272e30dacf60ce9.tar.xz
discoin-d7637c5a3f1d62922594cdfb6272e30dacf60ce9.zip
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.
Diffstat (limited to 'src/wallet/wallet.cpp')
-rw-r--r--src/wallet/wallet.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 597d108ae..61d068622 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -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);