From 7859b1392866e2aad93623e3178feb995c9dc25f Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 5 Jan 2023 08:22:02 -0500 Subject: [PATCH] don't set default restore height for random wallet --- src/wallet/monero_wallet_full.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wallet/monero_wallet_full.cpp b/src/wallet/monero_wallet_full.cpp index 64834f2..c9c8e20 100644 --- a/src/wallet/monero_wallet_full.cpp +++ b/src/wallet/monero_wallet_full.cpp @@ -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());