don't set default restore height for random wallet

This commit is contained in:
woodser
2023-01-05 08:22:02 -05:00
parent fdc382c1f5
commit 7859b13928
+3 -2
View File
@@ -1079,19 +1079,20 @@ namespace monero {
if (config.m_seed_offset == boost::none) config_normalized.m_seed_offset = std::string("");
if (config.m_account_lookahead != boost::none && config.m_subaddress_lookahead == boost::none) throw std::runtime_error("No subaddress lookahead provided with account lookahead");
if (config.m_account_lookahead == boost::none && config.m_subaddress_lookahead != boost::none) throw std::runtime_error("No account lookahead provided with subaddress lookahead");
if (config.m_restore_height == boost::none) config_normalized.m_restore_height = 0;
// create wallet
if (!config_normalized.m_mnemonic.get().empty()) {
if (config.m_restore_height == boost::none) config_normalized.m_restore_height = 0;
if (!config_normalized.m_language.get().empty()) throw std::runtime_error("Cannot specify language when creating wallet from mnemonic");
return create_wallet_from_mnemonic(config_normalized, std::move(http_client_factory));
} else if (!config_normalized.m_primary_address.get().empty() || !config_normalized.m_private_spend_key.get().empty()) {
if (config.m_restore_height == boost::none) config_normalized.m_restore_height = 0;
if (!config_normalized.m_seed_offset.get().empty()) throw std::runtime_error("Cannot specify seed offset when creating wallet from keys");
if (config_normalized.m_language.get().empty()) config_normalized.m_language = std::string("English");
if (!monero_utils::is_valid_language(config_normalized.m_language.get())) throw std::runtime_error("Unknown language: " + config_normalized.m_language.get());
return create_wallet_from_keys(config_normalized, std::move(http_client_factory));
} else {
if (!config_normalized.m_seed_offset.get().empty()) throw std::runtime_error("Cannot specify seed offset when creating wallet from keys");
if (!config_normalized.m_seed_offset.get().empty()) throw std::runtime_error("Cannot specify seed offset when creating random wallet");
if (config_normalized.m_restore_height != boost::none) throw std::runtime_error("Cannot specify restore height when creating random wallet");
if (config_normalized.m_language.get().empty()) config_normalized.m_language = std::string("English");
if (!monero_utils::is_valid_language(config_normalized.m_language.get())) throw std::runtime_error("Unknown language: " + config_normalized.m_language.get());