Replace inline initializations with the new constructor syntax while maintaining the same behavior.
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <nano/lib/numbers.hpp>
|
|
#include <nano/lib/stats_enums.hpp>
|
|
|
|
#include <chrono>
|
|
#include <memory>
|
|
|
|
namespace nano
|
|
{
|
|
class block;
|
|
}
|
|
|
|
namespace nano
|
|
{
|
|
/* Defines the possible states for an election to stop in */
|
|
enum class election_status_type : uint8_t
|
|
{
|
|
ongoing = 0,
|
|
active_confirmed_quorum = 1,
|
|
active_confirmation_height = 2,
|
|
inactive_confirmation_height = 3,
|
|
stopped = 5
|
|
};
|
|
|
|
nano::stat::detail to_stat_detail (election_status_type);
|
|
|
|
/* Holds a summary of an election */
|
|
class election_status final
|
|
{
|
|
public:
|
|
std::shared_ptr<nano::block> winner;
|
|
nano::amount tally{ 0 };
|
|
nano::amount final_tally{ 0 };
|
|
std::chrono::milliseconds election_end{ std::chrono::duration_cast<std::chrono::milliseconds> (std::chrono::system_clock::now ().time_since_epoch ()) };
|
|
std::chrono::milliseconds election_duration{ std::chrono::duration_values<std::chrono::milliseconds>::zero () };
|
|
unsigned confirmation_request_count{ 0 };
|
|
unsigned vote_broadcast_count{ 0 };
|
|
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<nano::block> block_a, election_status_type type_a = nano::election_status_type::ongoing) :
|
|
winner (block_a),
|
|
type (type_a)
|
|
{
|
|
block_count = 1;
|
|
}
|
|
};
|
|
}
|