From 05a12ccc2dc920f4a997e66e6965ae60c1a4c65e Mon Sep 17 00:00:00 2001 From: whythat Date: Sun, 21 Jan 2018 17:29:55 +0200 Subject: options: remove testnet-* options --- src/p2p/net_node.cpp | 9 +++------ src/p2p/net_node.h | 3 +-- src/p2p/net_node.inl | 10 ++-------- 3 files changed, 6 insertions(+), 16 deletions(-) (limited to 'src/p2p') diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp index 994941168..21a7fb50c 100644 --- a/src/p2p/net_node.cpp +++ b/src/p2p/net_node.cpp @@ -34,15 +34,12 @@ namespace nodetool { const command_line::arg_descriptor arg_p2p_bind_ip = {"p2p-bind-ip", "Interface for p2p network protocol", "0.0.0.0"}; - const command_line::arg_descriptor arg_p2p_bind_port = { + const command_line::arg_descriptor arg_p2p_bind_port = { "p2p-bind-port" , "Port for p2p network protocol" - , std::to_string(config::P2P_DEFAULT_PORT) - }; - const command_line::arg_descriptor arg_testnet_p2p_bind_port = { - "testnet-p2p-bind-port" - , "Port for testnet p2p network protocol" + , cryptonote::arg_testnet_on , std::to_string(config::testnet::P2P_DEFAULT_PORT) + , std::to_string(config::P2P_DEFAULT_PORT) }; const command_line::arg_descriptor arg_p2p_external_port = {"p2p-external-port", "External port for p2p network protocol (if port forwarding used with NAT)", 0}; const command_line::arg_descriptor arg_p2p_allow_local_ip = {"allow-local-ip", "Allow local ip add to peer list, mostly in debug purposes"}; diff --git a/src/p2p/net_node.h b/src/p2p/net_node.h index 9ebefbca6..54c474665 100644 --- a/src/p2p/net_node.h +++ b/src/p2p/net_node.h @@ -337,8 +337,7 @@ namespace nodetool const int64_t default_limit_up = 2048; const int64_t default_limit_down = 8192; extern const command_line::arg_descriptor arg_p2p_bind_ip; - extern const command_line::arg_descriptor arg_p2p_bind_port; - extern const command_line::arg_descriptor arg_testnet_p2p_bind_port; + extern const command_line::arg_descriptor arg_p2p_bind_port; extern const command_line::arg_descriptor arg_p2p_external_port; extern const command_line::arg_descriptor arg_p2p_allow_local_ip; extern const command_line::arg_descriptor > arg_p2p_add_peer; diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index d60f0a13e..c1de21f22 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -75,7 +75,6 @@ namespace nodetool { command_line::add_arg(desc, arg_p2p_bind_ip); command_line::add_arg(desc, arg_p2p_bind_port, false); - command_line::add_arg(desc, arg_testnet_p2p_bind_port, false); command_line::add_arg(desc, arg_p2p_external_port); command_line::add_arg(desc, arg_p2p_allow_local_ip); command_line::add_arg(desc, arg_p2p_add_peer); @@ -263,12 +262,8 @@ namespace nodetool const boost::program_options::variables_map& vm ) { - m_testnet = command_line::get_arg(vm, cryptonote::arg_testnet_on); - - auto p2p_bind_arg = m_testnet ? arg_testnet_p2p_bind_port : arg_p2p_bind_port; - m_bind_ip = command_line::get_arg(vm, arg_p2p_bind_ip); - m_port = command_line::get_arg(vm, p2p_bind_arg); + m_port = command_line::get_arg(vm, arg_p2p_bind_port); m_external_port = command_line::get_arg(vm, arg_p2p_external_port); 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); @@ -504,8 +499,7 @@ namespace nodetool } MDEBUG("Number of seed nodes: " << m_seed_nodes.size()); - auto config_arg = m_testnet ? cryptonote::arg_testnet_data_dir : cryptonote::arg_data_dir; - m_config_folder = command_line::get_arg(vm, config_arg); + m_config_folder = command_line::get_arg(vm, cryptonote::arg_data_dir); if ((!m_testnet && m_port != std::to_string(::config::P2P_DEFAULT_PORT)) || (m_testnet && m_port != std::to_string(::config::testnet::P2P_DEFAULT_PORT))) { -- cgit v1.2.3 From b3b2d4d20cc3c3cf3206468e66f2590c3aed948a Mon Sep 17 00:00:00 2001 From: whythat Date: Mon, 22 Jan 2018 03:49:51 +0200 Subject: options: add testnet option dependencies --- src/p2p/net_node.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/p2p') diff --git a/src/p2p/net_node.cpp b/src/p2p/net_node.cpp index 21a7fb50c..170b79984 100644 --- a/src/p2p/net_node.cpp +++ b/src/p2p/net_node.cpp @@ -37,9 +37,13 @@ namespace nodetool const command_line::arg_descriptor arg_p2p_bind_port = { "p2p-bind-port" , "Port for p2p network protocol" - , cryptonote::arg_testnet_on - , std::to_string(config::testnet::P2P_DEFAULT_PORT) , std::to_string(config::P2P_DEFAULT_PORT) + , cryptonote::arg_testnet_on + , [](bool testnet, bool defaulted, std::string val) { + if (testnet && defaulted) + return std::to_string(config::testnet::P2P_DEFAULT_PORT); + return val; + } }; const command_line::arg_descriptor arg_p2p_external_port = {"p2p-external-port", "External port for p2p network protocol (if port forwarding used with NAT)", 0}; const command_line::arg_descriptor arg_p2p_allow_local_ip = {"allow-local-ip", "Allow local ip add to peer list, mostly in debug purposes"}; -- cgit v1.2.3