Skip to content

Commit

Permalink
Add epoch timepoint for election end to confirmation_history (#1454)
Browse files Browse the repository at this point in the history
  • Loading branch information
argakiig authored and rkeene committed Dec 14, 2018
1 parent ffcaedc commit 16e2623
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions rai/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2836,6 +2836,7 @@ void rai::election::confirm_once (rai::transaction const & transaction_a)
{
if (!confirmed.exchange (true))
{
status.election_end = std::chrono::steady_clock::now ();
status.election_duration = std::chrono::duration_cast<std::chrono::milliseconds> (std::chrono::steady_clock::now () - election_start);
auto winner_l (status.winner);
auto node_l (node.shared ());
Expand Down
1 change: 1 addition & 0 deletions rai/node/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class election_status
public:
std::shared_ptr<rai::block> winner;
rai::amount tally;
std::chrono::steady_clock::time_point election_end;
std::chrono::milliseconds election_duration;
};
class vote_info
Expand Down
1 change: 1 addition & 0 deletions rai/node/rpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1454,6 +1454,7 @@ void rai::rpc_handler::confirmation_history ()
boost::property_tree::ptree election;
election.put ("hash", i->winner->hash ().to_string ());
election.put ("duration", i->election_duration.count ());
election.put ("time", i->election_end.time_since_epoch ().count ());
election.put ("tally", i->tally.to_string_dec ());
elections.push_back (std::make_pair ("", election));
running_total += i->election_duration;
Expand Down

0 comments on commit 16e2623

Please sign in to comment.