More frequent online weight sampling when testing

This commit is contained in:
Piotr Wójcik 2024-06-26 11:42:13 +02:00
commit b72b7d4c67
2 changed files with 6 additions and 7 deletions

View file

@ -114,8 +114,7 @@ TEST (vote_processor, weights)
auto & node (*system.nodes[0]);
// Create representatives of different weight levels
// FIXME: Using `online_weight_minimum` because calculation of trended and online weight is broken when running tests
auto const stake = node.config.online_weight_minimum.number ();
auto const stake = node.balance (nano::dev::genesis_key.pub);
auto const level0 = stake / 5000; // 0.02%
auto const level1 = stake / 500; // 0.2%
auto const level2 = stake / 50; // 2%
@ -142,10 +141,10 @@ TEST (vote_processor, weights)
node.stats.clear ();
ASSERT_TIMELY (5s, node.stats.count (nano::stat::type::rep_tiers, nano::stat::detail::updated) >= 2);
ASSERT_EQ (node.rep_tiers.tier (key0.pub), nano::rep_tier::none);
ASSERT_EQ (node.rep_tiers.tier (key1.pub), nano::rep_tier::tier_1);
ASSERT_EQ (node.rep_tiers.tier (key2.pub), nano::rep_tier::tier_2);
ASSERT_EQ (node.rep_tiers.tier (nano::dev::genesis_key.pub), nano::rep_tier::tier_3);
ASSERT_TIMELY_EQ (5s, node.rep_tiers.tier (key0.pub), nano::rep_tier::none);
ASSERT_TIMELY_EQ (5s, node.rep_tiers.tier (key1.pub), nano::rep_tier::tier_1);
ASSERT_TIMELY_EQ (5s, node.rep_tiers.tier (key2.pub), nano::rep_tier::tier_2);
ASSERT_TIMELY_EQ (5s, node.rep_tiers.tier (nano::dev::genesis_key.pub), nano::rep_tier::tier_3);
}
// Issue that tracks last changes on this test: https://github.com/nanocurrency/nano-node/issues/3485

View file

@ -255,7 +255,7 @@ nano::node_constants::node_constants (nano::network_constants & network_constant
search_pending_interval = network_constants.is_dev_network () ? std::chrono::seconds (1) : std::chrono::seconds (5 * 60);
unchecked_cleaning_interval = std::chrono::minutes (30);
process_confirmed_interval = network_constants.is_dev_network () ? std::chrono::milliseconds (50) : std::chrono::milliseconds (500);
weight_interval = std::chrono::minutes (5);
weight_interval = network_constants.is_dev_network () ? std::chrono::seconds (1) : std::chrono::minutes (5);
weight_cutoff = (network_constants.is_live_network () || network_constants.is_test_network ()) ? std::chrono::weeks (2) : std::chrono::days (1);
}