simplify election_status initialization
Replace inline initializations with the new constructor syntax while maintaining the same behavior.
This commit is contained in:
parent
0f1960d3b7
commit
bcf8ac0464
3 changed files with 11 additions and 2 deletions
|
|
@ -27,7 +27,7 @@ nano::election::election (nano::node & node_a, std::shared_ptr<nano::block> cons
|
||||||
live_vote_action (live_vote_action_a),
|
live_vote_action (live_vote_action_a),
|
||||||
node (node_a),
|
node (node_a),
|
||||||
behavior_m (election_behavior_a),
|
behavior_m (election_behavior_a),
|
||||||
status ({ block_a, 0, 0, std::chrono::duration_cast<std::chrono::milliseconds> (std::chrono::system_clock::now ().time_since_epoch ()), std::chrono::duration_values<std::chrono::milliseconds>::zero (), 0, 0, 1, 0, nano::election_status_type::ongoing }),
|
status (block_a),
|
||||||
height (block_a->sideband ().height),
|
height (block_a->sideband ().height),
|
||||||
root (block_a->root ()),
|
root (block_a->root ()),
|
||||||
qualified_root (block_a->qualified_root ())
|
qualified_root (block_a->qualified_root ())
|
||||||
|
|
|
||||||
|
|
@ -39,5 +39,14 @@ public:
|
||||||
unsigned block_count{ 0 };
|
unsigned block_count{ 0 };
|
||||||
unsigned voter_count{ 0 };
|
unsigned voter_count{ 0 };
|
||||||
election_status_type type{ nano::election_status_type::inactive_confirmation_height };
|
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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1196,7 +1196,7 @@ void nano::json_handler::block_confirm ()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Add record in confirmation history for confirmed block
|
// Add record in confirmation history for confirmed block
|
||||||
nano::election_status status{ block_l, 0, 0, std::chrono::duration_cast<std::chrono::milliseconds> (std::chrono::system_clock::now ().time_since_epoch ()), std::chrono::duration_values<std::chrono::milliseconds>::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);
|
node.active.recently_cemented.put (status);
|
||||||
// Trigger callback for confirmed block
|
// Trigger callback for confirmed block
|
||||||
auto account = block_l->account ();
|
auto account = block_l->account ();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue