Skip to content

Commit

Permalink
Moving election status definitions to secure/common
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermelawless committed Mar 2, 2020
1 parent 0732da0 commit de8d66e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 22 deletions.
2 changes: 0 additions & 2 deletions nano/node/active_transactions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ class node;
class block;
class block_sideband;
class election;
class election_status;
class vote;
class transaction;
class confirmation_height_processor;
enum class election_status_type : uint8_t;

class conflict_info final
{
Expand Down
20 changes: 0 additions & 20 deletions nano/node/election.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,6 @@ namespace nano
class channel;
class confirmation_solicitor;
class node;
enum class election_status_type : uint8_t
{
ongoing = 0,
active_confirmed_quorum = 1,
active_confirmation_height = 2,
inactive_confirmation_height = 3,
stopped = 5
};
class election_status final
{
public:
std::shared_ptr<nano::block> winner;
nano::amount tally;
std::chrono::milliseconds election_end;
std::chrono::milliseconds election_duration;
unsigned confirmation_request_count;
unsigned block_count;
unsigned voter_count;
election_status_type type;
};
class vote_info final
{
public:
Expand Down
24 changes: 24 additions & 0 deletions nano/secure/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,5 +506,29 @@ class ledger_cache
std::atomic<uint64_t> account_count{ 0 };
};

/* 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
};

/* Holds a summary of an election */
class election_status final
{
public:
std::shared_ptr<nano::block> winner;
nano::amount tally;
std::chrono::milliseconds election_end;
std::chrono::milliseconds election_duration;
unsigned confirmation_request_count;
unsigned block_count;
unsigned voter_count;
election_status_type type;
};

nano::wallet_id random_wallet_id ();
}

0 comments on commit de8d66e

Please sign in to comment.