Skip to content

Commit 771a304

Browse files
committed
Make sure we set the wallets min version to FEATURE_HD_SPLIT at the very first point
1 parent 1b3b5c6 commit 771a304

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/wallet/wallet.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3682,13 +3682,14 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile)
36823682
{
36833683
// Create new keyUser and set as default key
36843684
if (GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET) && !walletInstance->IsHDEnabled()) {
3685+
3686+
// ensure this wallet.dat can only be opened by clients supporting HD with chain split
3687+
walletInstance->SetMinVersion(FEATURE_HD_SPLIT);
3688+
36853689
// generate a new master key
36863690
CPubKey masterPubKey = walletInstance->GenerateNewHDMasterKey();
36873691
if (!walletInstance->SetHDMasterKey(masterPubKey))
36883692
throw std::runtime_error(std::string(__func__) + ": Storing master key failed");
3689-
3690-
// ensure this wallet.dat can only be opened by clients supporting HD with chain split
3691-
walletInstance->SetMinVersion(FEATURE_HD_SPLIT);
36923693
}
36933694
CPubKey newDefaultKey;
36943695
if (walletInstance->GetKeyFromPool(newDefaultKey, false)) {

0 commit comments

Comments
 (0)