From bca51423099113fa08cf04f38c14885acff1b0ba Mon Sep 17 00:00:00 2001 From: Srayman <42743016+Srayman@users.noreply.github.com> Date: Mon, 19 Apr 2021 11:09:28 -0400 Subject: [PATCH] Resolve issue with inactive votes cache not triggering elections to start (#3164) * Modifying voter count in inactive cache to trigger an election for different networks. Also removes bootstrap block count check as this can prevent triggering of elections shortly after a release or when a node is near fully bootstrapped. * resolves an error in vote_spacing.vote_generator test. changing vote hint to require minimum of 2 votes for dev network --- nano/node/active_transactions.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/nano/node/active_transactions.cpp b/nano/node/active_transactions.cpp index 5646cce5..307db67d 100644 --- a/nano/node/active_transactions.cpp +++ b/nano/node/active_transactions.cpp @@ -1491,7 +1491,7 @@ nano::inactive_cache_status nano::active_transactions::inactive_votes_bootstrap_ { debug_assert (!lock_a.owns_lock ()); nano::inactive_cache_status status (previously_a); - constexpr unsigned election_start_voters_min{ 5 }; + const unsigned election_start_voters_min = node.network_params.network.is_dev_network () ? 2 : node.network_params.network.is_beta_network () ? 5 : 15; status.tally = tally_a; if (!previously_a.confirmed && tally_a >= node.online_reps.delta ()) { @@ -1513,11 +1513,8 @@ nano::inactive_cache_status nano::active_transactions::inactive_votes_bootstrap_ auto block = node.store.block_get (transaction, hash_a); if (block && status.election_started && !previously_a.election_started && !node.block_confirmed_or_being_confirmed (transaction, hash_a)) { - if (node.ledger.cache.cemented_count >= node.ledger.bootstrap_weight_max_blocks) - { - lock_a.lock (); - insert_impl (lock_a, block); - } + lock_a.lock (); + insert_impl (lock_a, block); } else if (!block && status.bootstrap_started && !previously_a.bootstrap_started && (!node.ledger.pruning || !node.store.pruned_exists (transaction, hash_a))) {