diff options
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/command_line_args.h | 14 | ||||
-rw-r--r-- | src/daemon/core.h | 3 | ||||
-rw-r--r-- | src/daemon/daemon.cpp | 14 | ||||
-rw-r--r-- | src/daemon/main.cpp | 11 |
4 files changed, 10 insertions, 32 deletions
diff --git a/src/daemon/command_line_args.h b/src/daemon/command_line_args.h index ee6167b6a..90093b65e 100644 --- a/src/daemon/command_line_args.h +++ b/src/daemon/command_line_args.h @@ -76,16 +76,12 @@ namespace daemon_args , "127.0.0.1" }; - const command_line::arg_descriptor<std::string> arg_zmq_rpc_bind_port = { + const command_line::arg_descriptor<std::string, false, true> arg_zmq_rpc_bind_port = { "zmq-rpc-bind-port" - , "Port for ZMQ RPC server to listen on" - , std::to_string(config::ZMQ_RPC_DEFAULT_PORT) - }; - - const command_line::arg_descriptor<std::string> arg_zmq_testnet_rpc_bind_port = { - "zmq-testnet-rpc-bind-port" - , "Port for testnet ZMQ RPC server to listen on" - , std::to_string(config::testnet::ZMQ_RPC_DEFAULT_PORT) + , "Port for ZMQ RPC server to listen on" + , cryptonote::arg_testnet_on + , std::to_string(config::testnet::ZMQ_RPC_DEFAULT_PORT) + , std::to_string(config::ZMQ_RPC_DEFAULT_PORT) }; } // namespace daemon_args diff --git a/src/daemon/core.h b/src/daemon/core.h index f00dffccc..1ff696bef 100644 --- a/src/daemon/core.h +++ b/src/daemon/core.h @@ -69,8 +69,7 @@ public: std::string get_config_subdir() const { bool testnet = command_line::get_arg(m_vm_HACK, cryptonote::arg_testnet_on); - auto p2p_bind_arg = testnet ? nodetool::arg_testnet_p2p_bind_port : nodetool::arg_p2p_bind_port; - std::string port = command_line::get_arg(m_vm_HACK, p2p_bind_arg); + std::string port = command_line::get_arg(m_vm_HACK, nodetool::arg_p2p_bind_port); if ((!testnet && port != std::to_string(::config::P2P_DEFAULT_PORT)) || (testnet && port != std::to_string(::config::testnet::P2P_DEFAULT_PORT))) { return port; diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index 9b15e62ca..8053932fe 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -77,10 +77,10 @@ public: const auto testnet = command_line::get_arg(vm, cryptonote::arg_testnet_on); const auto restricted = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_restricted_rpc); - const auto main_rpc_port = command_line::get_arg(vm, testnet ? cryptonote::core_rpc_server::arg_testnet_rpc_bind_port : cryptonote::core_rpc_server::arg_rpc_bind_port); + const auto main_rpc_port = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_rpc_bind_port); rpcs.emplace_back(new t_rpc{vm, core, p2p, restricted, testnet, main_rpc_port, "core"}); - auto restricted_rpc_port_arg = testnet ? cryptonote::core_rpc_server::arg_testnet_rpc_restricted_bind_port : cryptonote::core_rpc_server::arg_rpc_restricted_bind_port; + auto restricted_rpc_port_arg = cryptonote::core_rpc_server::arg_rpc_restricted_bind_port; if(!command_line::is_arg_defaulted(vm, restricted_rpc_port_arg)) { auto restricted_rpc_port = command_line::get_arg(vm, restricted_rpc_port_arg); @@ -101,15 +101,7 @@ t_daemon::t_daemon( ) : mp_internals{new t_internals{vm}} { - bool testnet = command_line::get_arg(vm, cryptonote::arg_testnet_on); - if (testnet) - { - zmq_rpc_bind_port = command_line::get_arg(vm, daemon_args::arg_zmq_testnet_rpc_bind_port); - } - else - { - zmq_rpc_bind_port = command_line::get_arg(vm, daemon_args::arg_zmq_rpc_bind_port); - } + zmq_rpc_bind_port = command_line::get_arg(vm, daemon_args::arg_zmq_rpc_bind_port); zmq_rpc_bind_address = command_line::get_arg(vm, daemon_args::arg_zmq_rpc_bind_ip); } diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp index 7bac2d3d8..bef3b1a75 100644 --- a/src/daemon/main.cpp +++ b/src/daemon/main.cpp @@ -92,7 +92,6 @@ int main(int argc, char const * argv[]) command_line::add_arg(core_settings, daemon_args::arg_max_concurrency); command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_ip); command_line::add_arg(core_settings, daemon_args::arg_zmq_rpc_bind_port); - command_line::add_arg(core_settings, daemon_args::arg_zmq_testnet_rpc_bind_port); daemonizer::init_options(hidden_options, visible_options); daemonize::t_executor::init_options(core_settings); @@ -154,10 +153,6 @@ int main(int argc, char const * argv[]) return 0; } - bool testnet_mode = command_line::get_arg(vm, cryptonote::arg_testnet_on); - - auto data_dir_arg = testnet_mode ? cryptonote::arg_testnet_data_dir : cryptonote::arg_data_dir; - // data_dir // default: e.g. ~/.bitmonero/ or ~/.bitmonero/testnet // if data-dir argument given: @@ -166,7 +161,7 @@ int main(int argc, char const * argv[]) // Create data dir if it doesn't exist boost::filesystem::path data_dir = boost::filesystem::absolute( - command_line::get_arg(vm, data_dir_arg)); + command_line::get_arg(vm, cryptonote::arg_data_dir)); // FIXME: not sure on windows implementation default, needs further review //bf::path relative_path_base = daemonizer::get_relative_path_base(vm); @@ -226,10 +221,6 @@ int main(int argc, char const * argv[]) const cryptonote::rpc_args::descriptors arg{}; auto rpc_ip_str = command_line::get_arg(vm, arg.rpc_bind_ip); auto rpc_port_str = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_rpc_bind_port); - if (testnet_mode) - { - rpc_port_str = command_line::get_arg(vm, cryptonote::core_rpc_server::arg_testnet_rpc_bind_port); - } uint32_t rpc_ip; uint16_t rpc_port; |