Skip to content

Commit

Permalink
Make election behaviour mutable
Browse files Browse the repository at this point in the history
  • Loading branch information
gr0vity-dev committed Dec 2, 2024
1 parent 8d2d435 commit d3b180a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions nano/node/election.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ bool nano::election::state_change (nano::election_state expected_a, nano::electi

std::chrono::milliseconds nano::election::confirm_req_time () const
{
switch (behavior ())
switch (behavior_m)
{
case election_behavior::manual:
case election_behavior::priority:
Expand Down Expand Up @@ -314,7 +314,7 @@ bool nano::election::transition_time (nano::confirmation_solicitor & solicitor_a

std::chrono::milliseconds nano::election::time_to_live () const
{
switch (behavior ())
switch (behavior_m)
{
case election_behavior::manual:
case election_behavior::priority:
Expand Down Expand Up @@ -771,6 +771,7 @@ std::vector<nano::vote_with_weight_info> nano::election::votes_with_weight () co

nano::election_behavior nano::election::behavior () const
{
nano::lock_guard<nano::mutex> guard{ mutex };
return behavior_m;
}

Expand Down
2 changes: 1 addition & 1 deletion nano/node/election.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class election final : public std::enable_shared_from_this<election>
mutable nano::uint128_t final_weight{ 0 };
mutable std::unordered_map<nano::block_hash, nano::uint128_t> last_tally;

nano::election_behavior const behavior_m;
nano::election_behavior behavior_m;
std::chrono::steady_clock::time_point const election_start{ std::chrono::steady_clock::now () };

mutable nano::mutex mutex;
Expand Down

0 comments on commit d3b180a

Please sign in to comment.