Make election behaviour mutable

This commit is contained in:
gr0vity-dev 2024-12-02 22:32:22 +01:00
commit d3b180a2c5
2 changed files with 4 additions and 3 deletions

View file

@ -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::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;
}

View file

@ -180,7 +180,7 @@ private:
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;