From 63bd27e7d25c72c8d8aea895044ff13d9dfc39f7 Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Mon, 12 Oct 2015 15:15:46 -0400 Subject: [PATCH] adding initial seed nodes --- libraries/app/application.cpp | 47 +++++++++++++++++++++++++- libraries/chain/protocol/asset_ops.cpp | 2 +- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 6e9e29c3..fff0e625 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -103,7 +103,7 @@ namespace detail { void reset_p2p_node(const fc::path& data_dir) { try { - _p2p_network = std::make_shared("Graphene Reference Implementation"); + _p2p_network = std::make_shared("BitShares Reference Implementation"); _p2p_network->load_configuration(data_dir / "p2p"); _p2p_network->set_node_delegate(this); @@ -123,6 +123,50 @@ namespace detail { } } + if( _options->count("seed-nodes") ) + { + auto seeds_str = _options->at("seed-nodes").as(); + auto seeds = fc::json::from_string(seeds_str).as>(); + for( const string& endpoint_string : seeds ) + { + std::vector endpoints = resolve_string_to_ip_endpoints(endpoint_string); + for (const fc::ip::endpoint& endpoint : endpoints) + { + ilog("Adding seed node ${endpoint}", ("endpoint", endpoint)); + _p2p_network->add_node(endpoint); + _p2p_network->connect_to_endpoint(endpoint); + } + } + } + else + { + vector seeds = { + "faucet.bitshares.org:1776", + "bitshares.openledger.info:1776", + "blocktrades.us:1776", + "seed04.bitsharesnodes.com:1776", // thom + "seed05.bitsharesnodes.com:1776", // thom + "seed06.bitsharesnodes.com:1776", // thom + "seed07.bitsharesnodes.com:1776", // thom + "128.199.131.4:1777", // cube + "54.85.252.77:39705", // lafona + "104.236.144.84:1777", // puppies + "40.127.190.171:1777", // betax + "185.25.22.21:1776", // liondani (greece) + "23.95.43.126:50696", // iHashFury + "109.73.172.144:50696" // iHashFury + }; + for( const string& endpoint_string : seeds ) + { + std::vector endpoints = resolve_string_to_ip_endpoints(endpoint_string); + for (const fc::ip::endpoint& endpoint : endpoints) + { + ilog("Adding seed node ${endpoint}", ("endpoint", endpoint)); + _p2p_network->add_node(endpoint); + } + } + } + if( _options->count("p2p-endpoint") ) _p2p_network->listen_on_endpoint(fc::ip::endpoint::from_string(_options->at("p2p-endpoint").as()), true); else @@ -828,6 +872,7 @@ void application::set_program_options(boost::program_options::options_descriptio configuration_file_options.add_options() ("p2p-endpoint", bpo::value(), "Endpoint for P2P node to listen on") ("seed-node,s", bpo::value>()->composing(), "P2P nodes to connect to on startup (may specify multiple times)") + ("seed-nodes", bpo::value()->composing(), "JSON array of P2P nodes to connect to on startup") ("checkpoint,c", bpo::value>()->composing(), "Pairs of [BLOCK_NUM,BLOCK_ID] that should be enforced as checkpoints.") ("rpc-endpoint", bpo::value()->implicit_value("127.0.0.1:8090"), "Endpoint for websocket RPC to listen on") ("rpc-tls-endpoint", bpo::value()->implicit_value("127.0.0.1:8089"), "Endpoint for TLS websocket RPC to listen on") diff --git a/libraries/chain/protocol/asset_ops.cpp b/libraries/chain/protocol/asset_ops.cpp index add0f0cb..cffdb1dd 100644 --- a/libraries/chain/protocol/asset_ops.cpp +++ b/libraries/chain/protocol/asset_ops.cpp @@ -24,7 +24,7 @@ bool is_valid_symbol( const string& symbol ) if( symbol.size() < GRAPHENE_MIN_ASSET_SYMBOL_LENGTH ) return false; - if( symbol.substring(0,3) == "BIT" ) + if( symbol.substr(0,3) == "BIT" ) return false; if( symbol.size() > GRAPHENE_MAX_ASSET_SYMBOL_LENGTH )