diff --git a/nano/node/election.cpp b/nano/node/election.cpp index ee64237059..e0fd27800d 100644 --- a/nano/node/election.cpp +++ b/nano/node/election.cpp @@ -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: @@ -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: @@ -771,6 +771,7 @@ std::vector nano::election::votes_with_weight () co nano::election_behavior nano::election::behavior () const { + nano::lock_guard guard{ mutex }; return behavior_m; } diff --git a/nano/node/election.hpp b/nano/node/election.hpp index 718cbf680c..9a6850a384 100644 --- a/nano/node/election.hpp +++ b/nano/node/election.hpp @@ -180,7 +180,7 @@ class election final : public std::enable_shared_from_this mutable nano::uint128_t final_weight{ 0 }; mutable std::unordered_map 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;