From b50182aee71f3068f3ce4857f578db39767b8a80 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 17 Jan 2018 11:17:21 +0000 Subject: [PATCH 1/2] p2p: don't connect to seeds if using an exclusive peer --- src/p2p/net_node.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 269a9ba87..142351801 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -1107,7 +1107,7 @@ namespace nodetool template bool node_server::connect_to_seed() { - if (m_seed_nodes.empty() || m_offline) + if (m_seed_nodes.empty() || m_offline || !m_exclusive_peers.empty()) return true; size_t try_count = 0; From fd1dfac5d21736d83ca1076b06aba0813b22dd8e Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Wed, 17 Jan 2018 12:01:42 +0000 Subject: [PATCH 2/2] p2p: don't lookup seed IPs if using an exclusive peer --- src/p2p/net_node.inl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 142351801..fb4b5ffa7 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -270,6 +270,7 @@ namespace nodetool m_allow_local_ip = command_line::get_arg(vm, arg_p2p_allow_local_ip); m_no_igd = command_line::get_arg(vm, arg_no_igd); m_offline = command_line::get_arg(vm, cryptonote::arg_offline); + m_testnet = command_line::get_arg(vm, cryptonote::arg_testnet_on); if (command_line::has_arg(vm, arg_p2p_add_peer)) { @@ -398,14 +399,16 @@ namespace nodetool bool node_server::init(const boost::program_options::variables_map& vm) { std::set full_addrs; - m_testnet = command_line::get_arg(vm, cryptonote::arg_testnet_on); + + bool res = handle_command_line(vm); + CHECK_AND_ASSERT_MES(res, false, "Failed to handle command line"); if (m_testnet) { memcpy(&m_network_id, &::config::testnet::NETWORK_ID, 16); full_addrs = get_seed_nodes(true); } - else + else if (m_exclusive_peers.empty()) { memcpy(&m_network_id, &::config::NETWORK_ID, 16); // for each hostname in the seed nodes list, attempt to DNS resolve and @@ -496,9 +499,6 @@ namespace nodetool } MDEBUG("Number of seed nodes: " << m_seed_nodes.size()); - bool res = handle_command_line(vm); - CHECK_AND_ASSERT_MES(res, false, "Failed to handle command line"); - auto config_arg = m_testnet ? cryptonote::arg_testnet_data_dir : cryptonote::arg_data_dir; m_config_folder = command_line::get_arg(vm, config_arg);