diff options
author | stoffu <stoffu@protonmail.ch> | 2018-06-11 12:16:29 +0900 |
---|---|---|
committer | stoffu <stoffu@protonmail.ch> | 2018-06-11 20:17:02 +0900 |
commit | 08b85a8e00c0b3e5bb7c4d05861f8a42593cecf1 (patch) | |
tree | ce324669f3a27cecf55e4d538081135186a2e552 /src/p2p/net_node.inl | |
parent | Merge pull request #3340 (diff) | |
download | monero-08b85a8e00c0b3e5bb7c4d05861f8a42593cecf1.tar.xz |
cryptonote_config: add get_config to refactor x = testnet ? config::testnet::X : stagenet ? config::stagenet::X : config::X
Diffstat (limited to '')
-rw-r--r-- | src/p2p/net_node.inl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 9b21705ec..58034f191 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -273,7 +273,7 @@ namespace nodetool { nodetool::peerlist_entry pe = AUTO_VAL_INIT(pe); pe.id = crypto::rand<uint64_t>(); - const uint16_t default_port = testnet ? ::config::testnet::P2P_DEFAULT_PORT : stagenet ? ::config::stagenet::P2P_DEFAULT_PORT : ::config::P2P_DEFAULT_PORT; + const uint16_t default_port = cryptonote::get_config(m_nettype).P2P_DEFAULT_PORT; bool r = parse_peer_from_string(pe.adr, pr_str, default_port); CHECK_AND_ASSERT_MES(r, false, "Failed to parse address from string: " << pr_str); m_command_line_peers.push_back(pe); @@ -483,7 +483,7 @@ namespace nodetool if (result.size()) { for (const auto& addr_string : result) - full_addrs.insert(addr_string + ":" + std::to_string(m_nettype == cryptonote::TESTNET ? ::config::testnet::P2P_DEFAULT_PORT : m_nettype == cryptonote::STAGENET ? ::config::stagenet::P2P_DEFAULT_PORT : ::config::P2P_DEFAULT_PORT)); + full_addrs.insert(addr_string + ":" + std::to_string(cryptonote::get_config(m_nettype).P2P_DEFAULT_PORT)); } ++i; } @@ -1807,7 +1807,7 @@ namespace nodetool for(const std::string& pr_str: perrs) { epee::net_utils::network_address na = AUTO_VAL_INIT(na); - const uint16_t default_port = m_nettype == cryptonote::TESTNET ? ::config::testnet::P2P_DEFAULT_PORT : m_nettype == cryptonote::STAGENET ? ::config::stagenet::P2P_DEFAULT_PORT : ::config::P2P_DEFAULT_PORT; + const uint16_t default_port = cryptonote::get_config(m_nettype).P2P_DEFAULT_PORT; bool r = parse_peer_from_string(na, pr_str, default_port); CHECK_AND_ASSERT_MES(r, false, "Failed to parse address from string: " << pr_str); container.push_back(na); |