Skip to content

Commit

Permalink
transition active for non live traffic (#4798)
Browse files Browse the repository at this point in the history
Co-authored-by: gr0vity-dev <[email protected]>
  • Loading branch information
gr0vity-dev and gr0vity-dev authored Dec 14, 2024
1 parent ded11cf commit adbb40c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions nano/node/active_elections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,25 @@ nano::election_insertion_result nano::active_elections::insert (std::shared_ptr<
debug_assert (count_by_behavior[result.election->behavior ()] >= 0);
count_by_behavior[result.election->behavior ()]++;

// Skip passive phase for blocks without cached votes to avoid bootstrap delays
bool active_immediately = false;
if (node.vote_cache.contains (hash))
{
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_started, to_stat_detail (election_behavior_a));

node.logger.trace (nano::log::type::active_elections, nano::log::detail::active_started,
nano::log::arg{ "behavior", election_behavior_a },
nano::log::arg{ "election", result.election });

node.logger.debug (nano::log::type::active_elections, "Started new election for block: {} (behavior: {})",
node.logger.debug (nano::log::type::active_elections, "Started new election for block: {} (behavior: {}, active immediately: {})",
hash.to_string (),
to_string (election_behavior_a));
to_string (election_behavior_a),
active_immediately);
}
else
{
Expand Down

0 comments on commit adbb40c

Please sign in to comment.