diff --git a/nano/node/election.cpp b/nano/node/election.cpp index c42b55b771..125c4675fb 100644 --- a/nano/node/election.cpp +++ b/nano/node/election.cpp @@ -27,7 +27,7 @@ nano::election::election (nano::node & node_a, std::shared_ptr cons live_vote_action (live_vote_action_a), node (node_a), behavior_m (election_behavior_a), - status ({ block_a, 0, 0, std::chrono::duration_cast (std::chrono::system_clock::now ().time_since_epoch ()), std::chrono::duration_values::zero (), 0, 0, 1, 0, nano::election_status_type::ongoing }), + status (block_a), height (block_a->sideband ().height), root (block_a->root ()), qualified_root (block_a->qualified_root ()) diff --git a/nano/node/election_status.hpp b/nano/node/election_status.hpp index a69a490982..d75b7e3a99 100644 --- a/nano/node/election_status.hpp +++ b/nano/node/election_status.hpp @@ -39,5 +39,14 @@ class election_status final unsigned block_count{ 0 }; unsigned voter_count{ 0 }; election_status_type type{ nano::election_status_type::inactive_confirmation_height }; + + election_status () = default; + + election_status (std::shared_ptr block_a, election_status_type type_a = nano::election_status_type::ongoing) : + winner (block_a), + type (type_a) + { + block_count = 1; + } }; } diff --git a/nano/node/json_handler.cpp b/nano/node/json_handler.cpp index 735da1e0a4..708e0e3f98 100644 --- a/nano/node/json_handler.cpp +++ b/nano/node/json_handler.cpp @@ -1196,7 +1196,7 @@ void nano::json_handler::block_confirm () else { // Add record in confirmation history for confirmed block - nano::election_status status{ block_l, 0, 0, std::chrono::duration_cast (std::chrono::system_clock::now ().time_since_epoch ()), std::chrono::duration_values::zero (), 0, 0, 1, 0, nano::election_status_type::active_confirmation_height }; + nano::election_status status{ block_l, nano::election_status_type::active_confirmation_height }; node.active.recently_cemented.put (status); // Trigger callback for confirmed block auto account = block_l->account ();