Skip to content

Commit

Permalink
Add SEED_NODE_PEERS definition, automatically add to peerlist on init
Browse files Browse the repository at this point in the history
  • Loading branch information
who-biz committed Jul 29, 2020
1 parent 456f21b commit b60a4f6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/p2p/net_node.inl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@

#define MIN_WANTED_SEED_NODES 3

#define SEED_NODE_PEERS { "66.70.189.183", "66.70.189.131", "66.70.188.178", "51.79.66.36", "51.79.66.123", "51.79.64.184" }


namespace nodetool
{
inline bool append_net_address(std::vector<epee::net_utils::network_address> & seed_nodes, std::string const & addr, uint16_t default_port);
Expand Down Expand Up @@ -482,6 +485,19 @@ namespace nodetool
res = m_peerlist.init(m_allow_local_ip);
CHECK_AND_ASSERT_MES(res, false, "Failed to init peerlist.");

if (m_nettype == cryptonote::MAINNET) {
std::vector<std::string> seed_peers = SEED_NODE_PEERS;
for (const auto& each: seed_peers) {
nodetool::peerlist_entry pe = AUTO_VAL_INIT(pe);
pe.id = crypto::rand<uint64_t>();
const uint16_t default_port = cryptonote::get_config(m_nettype).P2P_DEFAULT_PORT;
bool r = parse_peer_from_string(pe.adr, each, default_port);
if (r)
{
m_command_line_peers.push_back(pe);
}
}
}

for(auto& p: m_command_line_peers)
m_peerlist.append_with_peer_white(p);
Expand Down

0 comments on commit b60a4f6

Please sign in to comment.