diff --git a/nano/node/bootstrap/bootstrap_connections.cpp b/nano/node/bootstrap/bootstrap_connections.cpp index 93e66ac550..630339c496 100644 --- a/nano/node/bootstrap/bootstrap_connections.cpp +++ b/nano/node/bootstrap/bootstrap_connections.cpp @@ -272,7 +272,6 @@ void nano::bootstrap_connections::populate_connections (bool repeat) if (node.config.logging.bulk_pull_logging ()) { - nano::unique_lock 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)); } @@ -284,11 +283,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 lock (mutex); endpoints.insert (endpoint); + nano::lock_guard lock (mutex); new_connections_empty = false; } else if (connections_count == 0) diff --git a/nano/node/cli.cpp b/nano/node/cli.cpp index 35080e6aa7..45f4823af6 100644 --- a/nano/node/cli.cpp +++ b/nano/node/cli.cpp @@ -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(), "Increase sideband batch size, default 512") ("block_processor_batch_size", boost::program_options::value(), "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) { diff --git a/nano/node/nodeconfig.hpp b/nano/node/nodeconfig.hpp index 74a2fcab29..b982e67b0b 100644 --- a/nano/node/nodeconfig.hpp +++ b/nano/node/nodeconfig.hpp @@ -129,6 +129,7 @@ class node_flags final 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 };