fix: if hdseed is wrong - do not setup random seed, user can lost his fund

This commit is contained in:
Konstantin Akimov 2024-04-23 16:57:54 +07:00
parent e52498b7d5
commit e5129e6c41
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -4609,7 +4609,8 @@ std::shared_ptr<CWallet> CWallet::Create(interfaces::Chain& chain, interfaces::C
newHdChain.AddAccount();
} else {
if (gArgs.IsArgSet("-hdseed") && !IsHex(strSeed)) {
walletInstance->WalletLogPrintf("%s -- Incorrect seed, generating a random mnemonic instead\n", __func__);
error = strprintf(_("%s -- Incorrect seed, it should be a hex string"), __func__);
return nullptr;
}
SecureString secureMnemonic = gArgs.GetArg("-mnemonic", "").c_str();
SecureString secureMnemonicPassphrase = gArgs.GetArg("-mnemonicpassphrase", "").c_str();