Make election behaviour mutable
This commit is contained in:
parent
8d2d4354a0
commit
d3b180a2c5
2 changed files with 4 additions and 3 deletions
|
|
@ -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
|
std::chrono::milliseconds nano::election::confirm_req_time () const
|
||||||
{
|
{
|
||||||
switch (behavior ())
|
switch (behavior_m)
|
||||||
{
|
{
|
||||||
case election_behavior::manual:
|
case election_behavior::manual:
|
||||||
case election_behavior::priority:
|
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
|
std::chrono::milliseconds nano::election::time_to_live () const
|
||||||
{
|
{
|
||||||
switch (behavior ())
|
switch (behavior_m)
|
||||||
{
|
{
|
||||||
case election_behavior::manual:
|
case election_behavior::manual:
|
||||||
case election_behavior::priority:
|
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::election_behavior nano::election::behavior () const
|
||||||
{
|
{
|
||||||
|
nano::lock_guard<nano::mutex> guard{ mutex };
|
||||||
return behavior_m;
|
return behavior_m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ private:
|
||||||
mutable nano::uint128_t final_weight{ 0 };
|
mutable nano::uint128_t final_weight{ 0 };
|
||||||
mutable std::unordered_map<nano::block_hash, nano::uint128_t> last_tally;
|
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 () };
|
std::chrono::steady_clock::time_point const election_start{ std::chrono::steady_clock::now () };
|
||||||
|
|
||||||
mutable nano::mutex mutex;
|
mutable nano::mutex mutex;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue