Skip to content

Commit

Permalink
TRACE VOTES
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Jan 30, 2024
1 parent 22d0bc9 commit 781dd4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions nano/lib/logging_enums.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ enum class detail
election_confirmed,
election_expired,
broadcast_vote,
process_vote,

// blockprocessor
block_processed,
Expand Down
9 changes: 9 additions & 0 deletions nano/node/election.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,22 @@ nano::election_vote_result nano::election::vote (nano::account const & rep, uint
return nano::election_vote_result (false, false);
}
}

last_votes[rep] = { std::chrono::steady_clock::now (), timestamp_a, block_hash_a };
if (vote_source_a == vote_source::live)
{
live_vote_action (rep);
}

node.stats.inc (nano::stat::type::election, vote_source_a == vote_source::live ? nano::stat::detail::vote_new : nano::stat::detail::vote_cached);
node.logger.trace (nano::log::type::election, nano::log::detail::process_vote,
nano::log::arg{ "id", id },
nano::log::arg{ "qualified_root", qualified_root },
nano::log::arg{ "account", rep },
nano::log::arg{ "timestamp", timestamp_a },
nano::log::arg{ "hash", block_hash_a },
nano::log::arg{ "vote_source", vote_source_a },
nano::log::arg{ "weight", weight });

if (!confirmed_locked ())
{
Expand Down

0 comments on commit 781dd4e

Please sign in to comment.