Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/wallet/monero_wallet_full.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,7 @@ namespace monero {
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());
if (config.m_network_type == boost::none) throw std::runtime_error("Must provide wallet network type");
if (config.m_regtest != boost::none && *config.m_regtest == true && *config.m_network_type != monero_network_type::MAINNET) throw std::runtime_error("Network type must be mainnet when using regtest option");

// create wallet
if (!config_normalized.m_seed.get().empty()) {
Expand Down Expand Up @@ -1137,6 +1138,10 @@ namespace monero {
if (http_client_factory == nullptr) wallet->m_w2 = std::unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(config.m_network_type.get()), 1, true));
else wallet->m_w2 = std::unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(config.m_network_type.get()), 1, true, std::move(http_client_factory)));
wallet->m_w2->init("");
if (config.m_regtest != boost::none && config.m_regtest.get() == true) {
wallet->m_w2->allow_mismatched_daemon_version(true);
wallet->m_w2->max_reorg_depth(100000);
}
wallet->set_daemon_connection(config.m_server);
wallet->m_w2->set_seed_language(language);
if (config.m_account_lookahead != boost::none) wallet->m_w2->set_subaddress_lookahead(config.m_account_lookahead.get(), config.m_subaddress_lookahead.get());
Expand Down Expand Up @@ -1232,6 +1237,10 @@ namespace monero {
else if (has_spend_key) wallet->m_w2->generate(config.m_path.get(), config.m_password.get(), spend_key_sk, true, false);
else wallet->m_w2->generate(config.m_path.get(), config.m_password.get(), address_info.address, view_key_sk);
wallet->m_w2->init("");
if (config.m_regtest != boost::none && config.m_regtest.get() == true) {
wallet->m_w2->allow_mismatched_daemon_version(true);
wallet->m_w2->max_reorg_depth(100000);
}
wallet->set_daemon_connection(config.m_server);
wallet->m_w2->set_refresh_from_block_height(config.m_restore_height.get());
wallet->m_w2->set_seed_language(config.m_language.get());
Expand All @@ -1251,6 +1260,10 @@ namespace monero {
if (http_client_factory == nullptr) wallet->m_w2 = std::unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(config.m_network_type.get()), 1, true));
else wallet->m_w2 = std::unique_ptr<tools::wallet2>(new tools::wallet2(static_cast<cryptonote::network_type>(config.m_network_type.get()), 1, true, std::move(http_client_factory)));
wallet->m_w2->init("");
if (config.m_regtest != boost::none && config.m_regtest.get() == true) {
wallet->m_w2->allow_mismatched_daemon_version(true);
wallet->m_w2->max_reorg_depth(100000);
}
wallet->set_daemon_connection(config.m_server);
wallet->m_w2->set_seed_language(config.m_language.get());
crypto::secret_key secret_key;
Expand Down
3 changes: 3 additions & 0 deletions src/wallet/monero_wallet_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ namespace monero {
m_account_lookahead = config.m_account_lookahead;
m_subaddress_lookahead = config.m_subaddress_lookahead;
m_is_multisig = config.m_is_multisig;
m_regtest = config.m_regtest;
}

monero_wallet_config monero_wallet_config::copy() const {
Expand Down Expand Up @@ -145,6 +146,7 @@ namespace monero {
// set bool values
if (m_save_current != boost::none) monero_utils::add_json_member("saveCurrent", m_save_current.get(), allocator, root);
if (m_is_multisig != boost::none) monero_utils::add_json_member("isMultisig", m_is_multisig.get(), allocator, root);
if (m_regtest != boost::none) monero_utils::add_json_member("regtest", m_regtest.get(), allocator, root);

// return root
return root;
Expand Down Expand Up @@ -182,6 +184,7 @@ namespace monero {
else if (key == std::string("accountLookahead")) config->m_account_lookahead = it->second.get_value<uint64_t>();
else if (key == std::string("subaddressLookahead")) config->m_subaddress_lookahead = it->second.get_value<uint64_t>();
else if (key == std::string("isMultisig")) config->m_is_multisig = it->second.get_value<bool>();
else if (key == std::string("regtest")) config->m_regtest = it->second.get_value<bool>();
}

return config;
Expand Down
1 change: 1 addition & 0 deletions src/wallet/monero_wallet_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ namespace monero {
boost::optional<uint64_t> m_account_lookahead;
boost::optional<uint64_t> m_subaddress_lookahead;
boost::optional<bool> m_is_multisig;
boost::optional<bool> m_regtest;

monero_wallet_config() {}
monero_wallet_config(const monero_wallet_config& config);
Expand Down