Use lowest priority for frontier accounts
This commit is contained in:
parent
bbfb7debb2
commit
026ab52511
3 changed files with 12 additions and 11 deletions
|
|
@ -81,7 +81,7 @@ void nano::bootstrap::account_sets::priority_down (nano::account const & account
|
|||
}
|
||||
}
|
||||
|
||||
void nano::bootstrap::account_sets::priority_set (nano::account const & account)
|
||||
void nano::bootstrap::account_sets::priority_set (nano::account const & account, double priority)
|
||||
{
|
||||
if (account.is_zero ())
|
||||
{
|
||||
|
|
@ -94,7 +94,7 @@ void nano::bootstrap::account_sets::priority_set (nano::account const & account)
|
|||
if (iter == priorities.get<tag_account> ().end ())
|
||||
{
|
||||
stats.inc (nano::stat::type::bootstrap_account_sets, nano::stat::detail::priority_insert);
|
||||
priorities.get<tag_account> ().insert ({ account, account_sets::priority_initial });
|
||||
priorities.get<tag_account> ().insert ({ account, priority });
|
||||
trim_overflow ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,13 @@ namespace bootstrap
|
|||
/** This class tracks accounts various account sets which are shared among the multiple bootstrap threads */
|
||||
class account_sets
|
||||
{
|
||||
public: // Constants
|
||||
static double constexpr priority_initial = 2.0;
|
||||
static double constexpr priority_increase = 2.0;
|
||||
static double constexpr priority_divide = 2.0;
|
||||
static double constexpr priority_max = 128.0;
|
||||
static double constexpr priority_cutoff = 0.15;
|
||||
|
||||
public:
|
||||
account_sets (account_sets_config const &, nano::stats &);
|
||||
|
||||
|
|
@ -38,7 +45,7 @@ namespace bootstrap
|
|||
* Current implementation divides priority by 2.0f and saturates down to 1.0f.
|
||||
*/
|
||||
void priority_down (nano::account const & account);
|
||||
void priority_set (nano::account const & account);
|
||||
void priority_set (nano::account const & account, double priority = priority_initial);
|
||||
|
||||
void block (nano::account const & account, nano::block_hash const & dependency);
|
||||
void unblock (nano::account const & account, std::optional<nano::block_hash> const & hash = std::nullopt);
|
||||
|
|
@ -148,13 +155,6 @@ namespace bootstrap
|
|||
ordered_priorities priorities;
|
||||
ordered_blocking blocking;
|
||||
|
||||
public: // Constants
|
||||
static double constexpr priority_initial = 2.0;
|
||||
static double constexpr priority_increase = 2.0;
|
||||
static double constexpr priority_divide = 2.0;
|
||||
static double constexpr priority_max = 128.0;
|
||||
static double constexpr priority_cutoff = 0.15;
|
||||
|
||||
public:
|
||||
using info_t = std::tuple<decltype (blocking), decltype (priorities)>; // <blocking, priorities>
|
||||
info_t info () const;
|
||||
|
|
|
|||
|
|
@ -981,7 +981,8 @@ void nano::bootstrap_service::process_frontiers (std::deque<std::pair<nano::acco
|
|||
|
||||
for (auto const & account : result)
|
||||
{
|
||||
accounts.priority_set (account);
|
||||
// Use the lowest possible priority here
|
||||
accounts.priority_set (account, nano::bootstrap::account_sets::priority_cutoff);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue