Disable peers banning after frontiers confirmation (#3118)

Disable peer banning.
This commit is contained in:
Sergey Kroshnin 2021-03-12 02:15:46 +03:00 committed by GitHub
commit 30eda74eeb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 11 deletions

View file

@ -408,7 +408,7 @@ TEST (bootstrap_processor, frontiers_unconfirmed)
ASSERT_FALSE (node3->ledger.block_exists (send1->hash ()));
ASSERT_FALSE (node3->ledger.block_exists (open1->hash ()));
ASSERT_EQ (1, node3->stats.count (nano::stat::type::bootstrap, nano::stat::detail::frontier_confirmation_failed, nano::stat::dir::in)); // failed request from node1
ASSERT_TRUE (node3->network.excluded_peers.check (nano::transport::map_endpoint_to_tcp (node1->network.endpoint ())));
ASSERT_FALSE (node3->network.excluded_peers.check (nano::transport::map_endpoint_to_tcp (node1->network.endpoint ()))); // Banning from bootstrap is disabled
}
TEST (bootstrap_processor, frontiers_confirmed)

View file

@ -145,16 +145,7 @@ void nano::bootstrap_attempt_legacy::attempt_restart_check (nano::unique_lock<na
if (!confirmed)
{
node->stats.inc (nano::stat::type::bootstrap, nano::stat::detail::frontier_confirmation_failed, nano::stat::dir::in);
auto score (node->network.excluded_peers.add (endpoint_frontier_request, node->network.size ()));
if (score >= nano::peer_exclusion::score_limit)
{
node->logger.always_log (boost::str (boost::format ("Adding peer %1% to excluded peers list with score %2% after %3% seconds bootstrap attempt") % endpoint_frontier_request % score % std::chrono::duration_cast<std::chrono::seconds> (std::chrono::steady_clock::now () - attempt_start).count ()));
auto channel = node->network.find_channel (nano::transport::map_tcp_to_endpoint (endpoint_frontier_request));
if (channel != nullptr)
{
node->network.erase (*channel);
}
}
node->logger.try_log (boost::str (boost::format ("Frontier confirmation failed for peer %1% after %2% seconds bootstrap attempt") % endpoint_frontier_request % std::chrono::duration_cast<std::chrono::seconds> (std::chrono::steady_clock::now () - attempt_start).count ()));
lock_a.unlock ();
stop ();
lock_a.lock ();