|
|
@ -3827,6 +3827,10 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile) |
|
|
|
if (fFirstRun) |
|
|
|
if (fFirstRun) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// ensure this wallet.dat can only be opened by clients supporting HD with chain split and expects no default key
|
|
|
|
// ensure this wallet.dat can only be opened by clients supporting HD with chain split and expects no default key
|
|
|
|
|
|
|
|
if (!gArgs.GetBoolArg("-usehd", true)) { |
|
|
|
|
|
|
|
InitError(strprintf(_("Error creating %s: You can't create non-HD wallets with this version."), walletFile)); |
|
|
|
|
|
|
|
return nullptr; |
|
|
|
|
|
|
|
} |
|
|
|
walletInstance->SetMinVersion(FEATURE_NO_DEFAULT_KEY); |
|
|
|
walletInstance->SetMinVersion(FEATURE_NO_DEFAULT_KEY); |
|
|
|
|
|
|
|
|
|
|
|
// generate a new master key
|
|
|
|
// generate a new master key
|
|
|
@ -3843,9 +3847,9 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile) |
|
|
|
walletInstance->SetBestChain(chainActive.GetLocator()); |
|
|
|
walletInstance->SetBestChain(chainActive.GetLocator()); |
|
|
|
} |
|
|
|
} |
|
|
|
else if (gArgs.IsArgSet("-usehd")) { |
|
|
|
else if (gArgs.IsArgSet("-usehd")) { |
|
|
|
bool useHD = gArgs.GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET); |
|
|
|
bool useHD = gArgs.GetBoolArg("-usehd", true); |
|
|
|
if (walletInstance->IsHDEnabled() && !useHD) { |
|
|
|
if (walletInstance->IsHDEnabled() && !useHD) { |
|
|
|
InitError(strprintf(_("Error loading %s: You can't disable HD on an already existing HD wallet or create new non-HD wallets."), walletFile)); |
|
|
|
InitError(strprintf(_("Error loading %s: You can't disable HD on an already existing HD wallet"), walletFile)); |
|
|
|
return nullptr; |
|
|
|
return nullptr; |
|
|
|
} |
|
|
|
} |
|
|
|
if (!walletInstance->IsHDEnabled() && useHD) { |
|
|
|
if (!walletInstance->IsHDEnabled() && useHD) { |
|
|
|