diff --git a/nano/core_test/bootstrap.cpp b/nano/core_test/bootstrap.cpp index ec30708ebf..ccebd97cd4 100644 --- a/nano/core_test/bootstrap.cpp +++ b/nano/core_test/bootstrap.cpp @@ -122,7 +122,7 @@ TEST (account_sets, priority_up_down) sets.priority_up (account); ASSERT_EQ (sets.priority (account), nano::bootstrap::account_sets::priority_initial); sets.priority_down (account); - ASSERT_EQ (sets.priority (account), nano::bootstrap::account_sets::priority_initial); + ASSERT_EQ (sets.priority (account), nano::bootstrap::account_sets::priority_initial / nano::bootstrap::account_sets::priority_divide); } TEST (account_sets, priority_down_empty) diff --git a/nano/node/bootstrap/account_sets.cpp b/nano/node/bootstrap/account_sets.cpp index 98d705dbdd..d73d314ae0 100644 --- a/nano/node/bootstrap/account_sets.cpp +++ b/nano/node/bootstrap/account_sets.cpp @@ -61,15 +61,18 @@ void nano::bootstrap::account_sets::priority_down (nano::account const & account { stats.inc (nano::stat::type::bootstrap_account_sets, nano::stat::detail::deprioritize); - if (it->fails >= account_sets::max_fails || it->fails >= it->priority) + auto priority = it->priority / account_sets::priority_divide; + + if (it->fails >= account_sets::max_fails || it->fails >= it->priority || priority <= account_sets::priority_cutoff) { stats.inc (nano::stat::type::bootstrap_account_sets, nano::stat::detail::erase_by_threshold); priorities.get ().erase (it); } else { - priorities.get ().modify (it, [] (auto & val) { + priorities.get ().modify (it, [priority] (auto & val) { val.fails += 1; + val.priority = priority; }); } }