Skip to content

Commit dd526c2

Browse files
committed
Don't switch to HD-chain-split during wallet encryption of non HD-chain-split wallets
1 parent 79df9df commit dd526c2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/wallet/wallet.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,10 +1306,6 @@ CPubKey CWallet::GenerateNewHDMasterKey()
13061306
bool CWallet::SetHDMasterKey(const CPubKey& pubkey)
13071307
{
13081308
LOCK(cs_wallet);
1309-
1310-
// ensure this wallet.dat can only be opened by clients supporting HD with chain split
1311-
SetMinVersion(FEATURE_HD_SPLIT);
1312-
13131309
// store the keyid (hash160) together with
13141310
// the child index counter in the database
13151311
// as a hdchain object
@@ -3670,6 +3666,9 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile)
36703666
CPubKey masterPubKey = walletInstance->GenerateNewHDMasterKey();
36713667
if (!walletInstance->SetHDMasterKey(masterPubKey))
36723668
throw std::runtime_error(std::string(__func__) + ": Storing master key failed");
3669+
3670+
// ensure this wallet.dat can only be opened by clients supporting HD with chain split
3671+
walletInstance->SetMinVersion(FEATURE_HD_SPLIT);
36733672
}
36743673
CPubKey newDefaultKey;
36753674
if (walletInstance->GetKeyFromPool(newDefaultKey, false)) {

0 commit comments

Comments
 (0)