mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Remove usehd option and warn when it is used
Removed the -usehd option so wallets cannot be made to be non-hd anymore. A warning will be displayed when the option is set.
This commit is contained in:
@@ -3829,17 +3829,13 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile)
|
||||
|
||||
if (fFirstRun)
|
||||
{
|
||||
// Create new keyUser and set as default key
|
||||
if (gArgs.GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET) && !walletInstance->IsHDEnabled()) {
|
||||
// ensure this wallet.dat can only be opened by clients supporting HD with chain split and expects no default key
|
||||
walletInstance->SetMinVersion(FEATURE_NO_DEFAULT_KEY);
|
||||
|
||||
// ensure this wallet.dat can only be opened by clients supporting HD with chain split and expects no default key
|
||||
walletInstance->SetMinVersion(FEATURE_NO_DEFAULT_KEY);
|
||||
|
||||
// generate a new master key
|
||||
CPubKey masterPubKey = walletInstance->GenerateNewHDMasterKey();
|
||||
if (!walletInstance->SetHDMasterKey(masterPubKey))
|
||||
throw std::runtime_error(std::string(__func__) + ": Storing master key failed");
|
||||
}
|
||||
// generate a new master key
|
||||
CPubKey masterPubKey = walletInstance->GenerateNewHDMasterKey();
|
||||
if (!walletInstance->SetHDMasterKey(masterPubKey))
|
||||
throw std::runtime_error(std::string(__func__) + ": Storing master key failed");
|
||||
|
||||
// Top up the keypool
|
||||
if (!walletInstance->TopUpKeyPool()) {
|
||||
@@ -3852,7 +3848,7 @@ CWallet* CWallet::CreateWalletFromFile(const std::string walletFile)
|
||||
else if (gArgs.IsArgSet("-usehd")) {
|
||||
bool useHD = gArgs.GetBoolArg("-usehd", DEFAULT_USE_HD_WALLET);
|
||||
if (walletInstance->IsHDEnabled() && !useHD) {
|
||||
InitError(strprintf(_("Error loading %s: You can't disable HD on an already existing HD wallet"), walletFile));
|
||||
InitError(strprintf(_("Error loading %s: You can't disable HD on an already existing HD wallet or create new non-HD wallets."), walletFile));
|
||||
return nullptr;
|
||||
}
|
||||
if (!walletInstance->IsHDEnabled() && useHD) {
|
||||
|
||||
Reference in New Issue
Block a user