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
This commit is contained in:
Srayman 2021-04-19 11:09:28 -04:00 committed by GitHub
commit bca5142309
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)))
{