mirror of
https://github.com/monero-project/monero.git
synced 2025-10-12 07:30:40 -04:00
cryptonote_config: add get_config to refactor x = testnet ? config::testnet::X : stagenet ? config::stagenet::X : config::X
This commit is contained in:
parent
25e7a7d96f
commit
08b85a8e00
6 changed files with 70 additions and 44 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue