Launch flag --allow_bootstrap_peers_duplicates (#2606)

Allowing multiple connections to same bootstrap server (useful in tests or for fastest beta nodes sync)
This commit is contained in:
Sergey Kroshnin 2020-02-28 19:35:58 +03:00 committed by GitHub
commit 90ea27ef68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View file

@ -273,7 +273,6 @@ void nano::bootstrap_connections::populate_connections (bool repeat)
if (node.config.logging.bulk_pull_logging ())
{
nano::unique_lock<std::mutex> lock (mutex);
node.logger.try_log (boost::str (boost::format ("Bulk pull connections: %1%, rate: %2% blocks/sec, bootstrap attempts %3%, remaining pulls: %4%") % connections_count.load () % (int)rate_sum % attempts_count % num_pulls));
}
@ -285,11 +284,11 @@ void nano::bootstrap_connections::populate_connections (bool repeat)
for (auto i = 0u; i < delta; i++)
{
auto endpoint (node.network.bootstrap_peer (true));
if (endpoint != nano::tcp_endpoint (boost::asio::ip::address_v6::any (), 0) && endpoints.find (endpoint) == endpoints.end () && !node.bootstrap_initiator.excluded_peers.check (endpoint))
if (endpoint != nano::tcp_endpoint (boost::asio::ip::address_v6::any (), 0) && (node.flags.allow_bootstrap_peers_duplicates || endpoints.find (endpoint) == endpoints.end ()) && !node.bootstrap_initiator.excluded_peers.check (endpoint))
{
connect_client (endpoint);
nano::lock_guard<std::mutex> lock (mutex);
endpoints.insert (endpoint);
nano::lock_guard<std::mutex> lock (mutex);
new_connections_empty = false;
}
else if (connections_count == 0)

View file

@ -96,6 +96,7 @@ void nano::add_node_flag_options (boost::program_options::options_description &
("disable_unchecked_drop", "Disables drop of unchecked table at startup")
("disable_providing_telemetry_metrics", "Disable using any node information in the telemetry_ack messages.")
("disable_block_processor_unchecked_deletion", "Disable deletion of unchecked blocks after processing")
("allow_bootstrap_peers_duplicates", "Allow multiple connections to same peer in bootstrap attempts")
("fast_bootstrap", "Increase bootstrap speed for high end nodes with higher limits")
("batch_size", boost::program_options::value<std::size_t>(), "Increase sideband batch size, default 512")
("block_processor_batch_size", boost::program_options::value<std::size_t>(), "Increase block processor transaction batch write size, default 0 (limited by config block_processor_batch_max_time), 256k for fast_bootstrap")
@ -134,6 +135,7 @@ std::error_code nano::update_flags (nano::node_flags & flags_a, boost::program_o
flags_a.disable_unchecked_cleanup = (vm.count ("disable_unchecked_cleanup") > 0);
flags_a.disable_unchecked_drop = (vm.count ("disable_unchecked_drop") > 0);
flags_a.disable_block_processor_unchecked_deletion = (vm.count ("disable_block_processor_unchecked_deletion") > 0);
flags_a.allow_bootstrap_peers_duplicates = (vm.count ("allow_bootstrap_peers_duplicates") > 0);
flags_a.fast_bootstrap = (vm.count ("fast_bootstrap") > 0);
if (flags_a.fast_bootstrap)
{

View file

@ -129,6 +129,7 @@ public:
bool disable_block_processor_unchecked_deletion{ false };
bool disable_block_processor_republishing{ false };
bool disable_ongoing_telemetry_requests{ false };
bool allow_bootstrap_peers_duplicates{ false };
bool fast_bootstrap{ false };
bool read_only{ false };
nano::confirmation_height_mode confirmation_height_processor_mode{ nano::confirmation_height_mode::automatic };