aboutsummaryrefslogtreecommitdiff
path: root/src/wallet
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2017-01-17 09:07:48 +0100
committerJonas Schnelli <dev@jonasschnelli.ch>2017-03-24 10:28:39 +0100
commitdd526c2a2d2f0f7427047891a5e94b4e6c18b190 (patch)
tree5571a574d24bbd2e2313b90e139ce4072065bf02 /src/wallet
parent79df9df3482d71391dee1dd59054aed8f7bbfa6b (diff)
downloadbitcoin-dd526c2a2d2f0f7427047891a5e94b4e6c18b190.tar.xz
Don't switch to HD-chain-split during wallet encryption of non HD-chain-split wallets
Diffstat (limited to 'src/wallet')
-rw-r--r--src/wallet/wallet.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 7ad48e37b0..7687810794 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1306,10 +1306,6 @@ CPubKey CWallet::GenerateNewHDMasterKey()
bool CWallet::SetHDMasterKey(const CPubKey& pubkey)
{
LOCK(cs_wallet);
-
- // ensure this wallet.dat can only be opened by clients supporting HD with chain split
- SetMinVersion(FEATURE_HD_SPLIT);
-
// store the keyid (hash160) together with
// the child index counter in the database
// as a hdchain object
@@ -3670,6 +3666,9 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile)
CPubKey masterPubKey = walletInstance->GenerateNewHDMasterKey();
if (!walletInstance->SetHDMasterKey(masterPubKey))
throw std::runtime_error(std::string(__func__) + ": Storing master key failed");
+
+ // ensure this wallet.dat can only be opened by clients supporting HD with chain split
+ walletInstance->SetMinVersion(FEATURE_HD_SPLIT);
}
CPubKey newDefaultKey;
if (walletInstance->GetKeyFromPool(newDefaultKey, false)) {