Fix activate immediately
This commit is contained in:
parent
e6a4c07bc9
commit
22ec17caaa
2 changed files with 10 additions and 4 deletions
|
|
@ -458,6 +458,7 @@ enum class detail
|
||||||
transition_priority,
|
transition_priority,
|
||||||
transition_priority_failed,
|
transition_priority_failed,
|
||||||
election_cleanup,
|
election_cleanup,
|
||||||
|
activate_immediately,
|
||||||
|
|
||||||
// active_elections
|
// active_elections
|
||||||
started,
|
started,
|
||||||
|
|
|
||||||
|
|
@ -419,11 +419,16 @@ nano::election_insertion_result nano::active_elections::insert (std::shared_ptr<
|
||||||
count_by_behavior[result.election->behavior ()]++;
|
count_by_behavior[result.election->behavior ()]++;
|
||||||
|
|
||||||
// Skip passive phase for blocks without cached votes to avoid bootstrap delays
|
// Skip passive phase for blocks without cached votes to avoid bootstrap delays
|
||||||
bool active_immediately = false;
|
bool activate_immediately = false;
|
||||||
if (node.vote_cache.contains (hash))
|
if (!node.vote_cache.contains (hash))
|
||||||
{
|
{
|
||||||
|
activate_immediately = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activate_immediately)
|
||||||
|
{
|
||||||
|
node.stats.inc (nano::stat::type::active_elections, nano::stat::detail::activate_immediately);
|
||||||
result.election->transition_active ();
|
result.election->transition_active ();
|
||||||
active_immediately = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
node.stats.inc (nano::stat::type::active_elections, nano::stat::detail::started);
|
node.stats.inc (nano::stat::type::active_elections, nano::stat::detail::started);
|
||||||
|
|
@ -436,7 +441,7 @@ nano::election_insertion_result nano::active_elections::insert (std::shared_ptr<
|
||||||
node.logger.debug (nano::log::type::active_elections, "Started new election for block: {} (behavior: {}, active immediately: {})",
|
node.logger.debug (nano::log::type::active_elections, "Started new election for block: {} (behavior: {}, active immediately: {})",
|
||||||
hash.to_string (),
|
hash.to_string (),
|
||||||
to_string (election_behavior_a),
|
to_string (election_behavior_a),
|
||||||
active_immediately);
|
activate_immediately);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue