Merge pull request #4728 from pwojcikdev/configs-rework
Rework configs for backlog, telemetry and bandwidth limiter
This commit is contained in:
commit
4fe3a897de
41 changed files with 461 additions and 575 deletions
|
|
@ -23,7 +23,6 @@ add_executable(
|
|||
enums.cpp
|
||||
epochs.cpp
|
||||
fair_queue.cpp
|
||||
frontiers_confirmation.cpp
|
||||
ipc.cpp
|
||||
ledger.cpp
|
||||
ledger_confirm.cpp
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ TEST (active_elections, DISABLED_keep_local)
|
|||
// Bound to 2, won't drop wallet created transactions, but good to test dropping remote
|
||||
node_config.active_elections.size = 2;
|
||||
// Disable frontier confirmation to allow the test to finish before
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
|
||||
auto & node = *system.add_node (node_config);
|
||||
auto & wallet (*system.wallet (0));
|
||||
|
|
@ -326,7 +326,7 @@ TEST (inactive_votes_cache, existing_vote)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (node_config);
|
||||
nano::block_hash latest (node.latest (nano::dev::genesis_key.pub));
|
||||
nano::keypair key;
|
||||
|
|
@ -380,7 +380,7 @@ TEST (inactive_votes_cache, multiple_votes)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (node_config);
|
||||
nano::keypair key1;
|
||||
nano::block_builder builder;
|
||||
|
|
@ -433,7 +433,7 @@ TEST (inactive_votes_cache, election_start)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
node_config.priority_scheduler.enabled = false;
|
||||
node_config.optimistic_scheduler.enabled = false;
|
||||
auto & node = *system.add_node (node_config);
|
||||
|
|
@ -539,7 +539,7 @@ TEST (active_elections, vote_replays)
|
|||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.enable_voting = false;
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (node_config);
|
||||
nano::keypair key;
|
||||
nano::state_block_builder builder;
|
||||
|
|
@ -695,7 +695,7 @@ TEST (active_elections, republish_winner)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node1 = *system.add_node (node_config);
|
||||
node_config.peering_port = system.get_available_port ();
|
||||
auto & node2 = *system.add_node (node_config);
|
||||
|
|
@ -761,7 +761,7 @@ TEST (active_elections, fork_filter_cleanup)
|
|||
nano::test::system system{};
|
||||
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
|
||||
auto & node1 = *system.add_node (node_config);
|
||||
nano::keypair key{};
|
||||
|
|
@ -842,7 +842,7 @@ TEST (active_elections, fork_replacement_tally)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node1 (*system.add_node (node_config));
|
||||
|
||||
size_t const reps_count = 20;
|
||||
|
|
@ -999,7 +999,7 @@ TEST (active_elections, confirmation_consistency)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (node_config);
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
for (unsigned i = 0; i < 10; ++i)
|
||||
|
|
@ -1091,7 +1091,7 @@ TEST (active_elections, activate_account_chain)
|
|||
nano::test::system system;
|
||||
nano::node_flags flags;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (config, flags);
|
||||
|
||||
nano::keypair key;
|
||||
|
|
@ -1183,7 +1183,7 @@ TEST (active_elections, activate_inactive)
|
|||
nano::test::system system;
|
||||
nano::node_flags flags;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (config, flags);
|
||||
|
||||
nano::keypair key;
|
||||
|
|
@ -1331,7 +1331,7 @@ TEST (active_elections, limit_vote_hinted_elections)
|
|||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
const int aec_limit = 10;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
config.optimistic_scheduler.enabled = false;
|
||||
config.active_elections.size = aec_limit;
|
||||
config.active_elections.hinted_limit_percentage = 10; // Should give us a limit of 1 hinted election
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/test_common/chains.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
|
@ -46,3 +47,30 @@ TEST (backlog, population)
|
|||
|
||||
ASSERT_TIMELY (5s, all_activated ());
|
||||
}
|
||||
|
||||
/*
|
||||
* Ensures that elections are activated without live traffic
|
||||
*/
|
||||
TEST (backlog, election_activation)
|
||||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
auto & node = *system.add_node (node_config);
|
||||
nano::keypair key;
|
||||
nano::block_builder builder;
|
||||
auto send = builder
|
||||
.state ()
|
||||
.account (nano::dev::genesis_key.pub)
|
||||
.previous (nano::dev::genesis->hash ())
|
||||
.representative (nano::dev::genesis_key.pub)
|
||||
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
|
||||
.link (key.pub)
|
||||
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
|
||||
.work (*node.work_generate_blocking (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
{
|
||||
auto transaction = node.ledger.tx_begin_write ();
|
||||
ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, send));
|
||||
}
|
||||
ASSERT_TIMELY_EQ (5s, node.active.size (), 1);
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ TEST (bootstrap_processor, process_one)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
node_config.enable_voting = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
|
|
@ -327,7 +327,7 @@ TEST (bootstrap_processor, process_two)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
auto node0 (system.add_node (config, node_flags));
|
||||
|
|
@ -348,7 +348,7 @@ TEST (bootstrap_processor, process_state)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
auto node0 (system.add_node (config, node_flags));
|
||||
|
|
@ -392,7 +392,7 @@ TEST (bootstrap_processor, process_new)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
nano::keypair key2;
|
||||
|
|
@ -430,7 +430,7 @@ TEST (bootstrap_processor, pull_diamond)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
auto node0 (system.add_node (config, node_flags));
|
||||
|
|
@ -482,7 +482,7 @@ TEST (bootstrap_processor, DISABLED_pull_requeue_network_error)
|
|||
// Bootstrap attempt stopped before requeue & then cannot be found in attempts list
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
auto node1 (system.add_node (config, node_flags));
|
||||
|
|
@ -574,7 +574,7 @@ TEST (bootstrap_processor, push_diamond)
|
|||
ASSERT_EQ (nano::block_status::progress, node1->process (receive));
|
||||
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags flags;
|
||||
flags.disable_ongoing_bootstrap = true;
|
||||
flags.disable_ascending_bootstrap = true;
|
||||
|
|
@ -587,7 +587,7 @@ TEST (bootstrap_processor, push_diamond_pruning)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags0;
|
||||
node_flags0.disable_ascending_bootstrap = true;
|
||||
node_flags0.disable_ongoing_bootstrap = true;
|
||||
|
|
@ -678,7 +678,7 @@ TEST (bootstrap_processor, push_one)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto node0 (system.add_node (config));
|
||||
nano::keypair key1;
|
||||
auto node1 = system.make_disconnected_node ();
|
||||
|
|
@ -700,7 +700,7 @@ TEST (bootstrap_processor, lazy_hash)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
auto node0 (system.add_node (config, node_flags));
|
||||
|
|
@ -774,7 +774,7 @@ TEST (bootstrap_processor, lazy_hash_bootstrap_id)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
auto node0 (system.add_node (config, node_flags));
|
||||
|
|
@ -848,7 +848,7 @@ TEST (bootstrap_processor, lazy_hash_pruning)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
config.enable_voting = false; // Remove after allowing pruned voting
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
|
|
@ -994,7 +994,7 @@ TEST (bootstrap_processor, lazy_max_pull_count)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
auto node0 (system.add_node (config, node_flags));
|
||||
|
|
@ -1095,7 +1095,7 @@ TEST (bootstrap_processor, lazy_unclear_state_link)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_legacy_bootstrap = true;
|
||||
|
|
@ -1163,7 +1163,7 @@ TEST (bootstrap_processor, lazy_unclear_state_link_not_existing)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_legacy_bootstrap = true;
|
||||
|
|
@ -1221,7 +1221,7 @@ TEST (bootstrap_processor, lazy_destinations)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_legacy_bootstrap = true;
|
||||
|
|
@ -1299,7 +1299,7 @@ TEST (bootstrap_processor, lazy_pruning_missing_block)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
config.enable_voting = false; // Remove after allowing pruned voting
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
|
|
@ -1406,7 +1406,7 @@ TEST (bootstrap_processor, lazy_cancel)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
auto node0 (system.add_node (config, node_flags));
|
||||
|
|
@ -1440,7 +1440,7 @@ TEST (bootstrap_processor, wallet_lazy_frontier)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_legacy_bootstrap = true;
|
||||
|
|
@ -1520,7 +1520,7 @@ TEST (bootstrap_processor, wallet_lazy_pending)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_legacy_bootstrap = true;
|
||||
|
|
@ -1584,7 +1584,7 @@ TEST (bootstrap_processor, multiple_attempts)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
auto node1 = system.add_node (config, node_flags);
|
||||
|
|
@ -1945,7 +1945,7 @@ TEST (bulk, genesis)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_lazy_bootstrap = true;
|
||||
|
|
@ -1971,7 +1971,7 @@ TEST (bulk, offline_send)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_lazy_bootstrap = true;
|
||||
|
|
@ -2010,7 +2010,7 @@ TEST (bulk, genesis_pruning)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
config.enable_voting = false; // Remove after allowing pruned voting
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ TEST (confirmation_callback, observer_callbacks)
|
|||
nano::test::system system;
|
||||
nano::node_flags node_flags;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
|
@ -122,7 +122,7 @@ TEST (confirmation_callback, confirmed_history)
|
|||
node_flags.force_use_write_queue = true;
|
||||
node_flags.disable_ascending_bootstrap = true;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
|
||||
nano::block_hash latest (node->latest (nano::dev::genesis_key.pub));
|
||||
|
|
@ -196,7 +196,7 @@ TEST (confirmation_callback, dependent_election)
|
|||
nano::node_flags node_flags;
|
||||
node_flags.force_use_write_queue = true;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
|
||||
nano::block_hash latest (node->latest (nano::dev::genesis_key.pub));
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ TEST (election, quorum_minimum_flip_success)
|
|||
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.online_weight_minimum = nano::dev::constants.genesis_amount;
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
|
||||
auto & node1 = *system.add_node (node_config);
|
||||
auto const latest_hash = nano::dev::genesis->hash ();
|
||||
|
|
@ -86,7 +86,7 @@ TEST (election, quorum_minimum_flip_fail)
|
|||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.online_weight_minimum = nano::dev::constants.genesis_amount;
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (node_config);
|
||||
nano::state_block_builder builder;
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ TEST (election, quorum_minimum_confirm_success)
|
|||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.online_weight_minimum = nano::dev::constants.genesis_amount;
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node1 = *system.add_node (node_config);
|
||||
nano::keypair key1;
|
||||
nano::block_builder builder;
|
||||
|
|
@ -167,7 +167,7 @@ TEST (election, quorum_minimum_confirm_fail)
|
|||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.online_weight_minimum = nano::dev::constants.genesis_amount;
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node1 = *system.add_node (node_config);
|
||||
|
||||
nano::block_builder builder;
|
||||
|
|
@ -205,7 +205,7 @@ TEST (election, quorum_minimum_update_weight_before_quorum_checks)
|
|||
nano::test::system system;
|
||||
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
|
||||
auto & node1 = *system.add_node (node_config);
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ TEST (election_scheduler, no_vacancy)
|
|||
|
||||
nano::node_config config = system.default_config ();
|
||||
config.active_elections.size = 1;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (config);
|
||||
|
||||
nano::state_block_builder builder{};
|
||||
|
|
|
|||
|
|
@ -1,84 +0,0 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
#include <nano/test_common/system.hpp>
|
||||
#include <nano/test_common/testutil.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
TEST (frontiers_confirmation, mode)
|
||||
{
|
||||
nano::keypair key;
|
||||
nano::block_builder builder;
|
||||
nano::node_flags node_flags;
|
||||
// Always mode
|
||||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::always;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
auto send = builder
|
||||
.state ()
|
||||
.account (nano::dev::genesis_key.pub)
|
||||
.previous (nano::dev::genesis->hash ())
|
||||
.representative (nano::dev::genesis_key.pub)
|
||||
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
|
||||
.link (key.pub)
|
||||
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
|
||||
.work (*node->work_generate_blocking (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
{
|
||||
auto transaction = node->ledger.tx_begin_write ();
|
||||
ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send));
|
||||
}
|
||||
ASSERT_TIMELY_EQ (5s, node->active.size (), 1);
|
||||
}
|
||||
// Auto mode
|
||||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::automatic;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
auto send = builder
|
||||
.state ()
|
||||
.account (nano::dev::genesis_key.pub)
|
||||
.previous (nano::dev::genesis->hash ())
|
||||
.representative (nano::dev::genesis_key.pub)
|
||||
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
|
||||
.link (key.pub)
|
||||
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
|
||||
.work (*node->work_generate_blocking (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
{
|
||||
auto transaction = node->ledger.tx_begin_write ();
|
||||
ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send));
|
||||
}
|
||||
ASSERT_TIMELY_EQ (5s, node->active.size (), 1);
|
||||
}
|
||||
// Disabled mode
|
||||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
auto send = builder
|
||||
.state ()
|
||||
.account (nano::dev::genesis_key.pub)
|
||||
.previous (nano::dev::genesis->hash ())
|
||||
.representative (nano::dev::genesis_key.pub)
|
||||
.balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio)
|
||||
.link (key.pub)
|
||||
.sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub)
|
||||
.work (*node->work_generate_blocking (nano::dev::genesis->hash ()))
|
||||
.build ();
|
||||
{
|
||||
auto transaction = node->ledger.tx_begin_write ();
|
||||
ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send));
|
||||
}
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
std::this_thread::sleep_for (std::chrono::seconds (1));
|
||||
ASSERT_EQ (0, node->active.size ());
|
||||
}
|
||||
}
|
||||
|
|
@ -1017,7 +1017,7 @@ TEST (votes, add_existing)
|
|||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.online_weight_minimum = nano::dev::constants.genesis_amount;
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node1 = *system.add_node (node_config);
|
||||
nano::keypair key1;
|
||||
nano::block_builder builder;
|
||||
|
|
@ -4266,7 +4266,7 @@ TEST (ledger, unchecked_epoch_invalid)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node1 (*system.add_node (node_config));
|
||||
nano::keypair destination;
|
||||
nano::block_builder builder;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ TEST (ledger_confirm, multiple_accounts)
|
|||
nano::test::system system;
|
||||
nano::node_flags node_flags;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
nano::keypair key1;
|
||||
nano::keypair key2;
|
||||
|
|
@ -232,7 +232,7 @@ TEST (ledger_confirm, send_receive_between_2_accounts)
|
|||
nano::test::system system;
|
||||
nano::node_flags node_flags;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
nano::keypair key1;
|
||||
nano::block_hash latest (node->latest (nano::dev::genesis_key.pub));
|
||||
|
|
@ -361,7 +361,7 @@ TEST (ledger_confirm, send_receive_self)
|
|||
nano::test::system system;
|
||||
nano::node_flags node_flags;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
nano::block_hash latest (node->latest (nano::dev::genesis_key.pub));
|
||||
|
||||
|
|
@ -449,7 +449,7 @@ TEST (ledger_confirm, all_block_types)
|
|||
nano::test::system system;
|
||||
nano::node_flags node_flags;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
nano::block_hash latest (node->latest (nano::dev::genesis_key.pub));
|
||||
nano::keypair key1;
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ TEST (node, auto_bootstrap)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config (system.get_available_port ());
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_lazy_bootstrap = true;
|
||||
|
|
@ -290,7 +290,7 @@ TEST (node, auto_bootstrap_reverse)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config (system.get_available_port ());
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_lazy_bootstrap = true;
|
||||
|
|
@ -311,7 +311,7 @@ TEST (node, auto_bootstrap_age)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config (system.get_available_port ());
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_lazy_bootstrap = true;
|
||||
|
|
@ -384,7 +384,7 @@ TEST (node, search_receivable_confirmed)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config);
|
||||
nano::keypair key2;
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
|
@ -413,7 +413,7 @@ TEST (node, search_receivable_pruned)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node1 = system.add_node (node_config);
|
||||
nano::node_flags node_flags;
|
||||
node_flags.enable_pruning = true;
|
||||
|
|
@ -733,7 +733,7 @@ TEST (node, fork_multi_flip)
|
|||
nano::test::system system;
|
||||
nano::node_flags node_flags;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node1 (*system.add_node (node_config, node_flags, type));
|
||||
node_config.peering_port = system.get_available_port ();
|
||||
auto & node2 (*system.add_node (node_config, node_flags, type));
|
||||
|
|
@ -785,7 +785,7 @@ TEST (node, fork_bootstrap_flip)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config0{ system.get_available_port () };
|
||||
config0.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config0.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_bootstrap_bulk_push_client = true;
|
||||
node_flags.disable_lazy_bootstrap = true;
|
||||
|
|
@ -1193,7 +1193,7 @@ TEST (node, DISABLED_broadcast_elected)
|
|||
nano::node_flags node_flags;
|
||||
nano::test::system system;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node0 = system.add_node (node_config, node_flags, type);
|
||||
node_config.peering_port = system.get_available_port ();
|
||||
auto node1 = system.add_node (node_config, node_flags, type);
|
||||
|
|
@ -1320,7 +1320,7 @@ TEST (node, rep_self_vote)
|
|||
nano::test::system system;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.online_weight_minimum = std::numeric_limits<nano::uint128_t>::max ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node0 = system.add_node (node_config);
|
||||
nano::keypair rep_big;
|
||||
nano::block_builder builder;
|
||||
|
|
@ -1415,10 +1415,10 @@ TEST (node, DISABLED_bootstrap_bulk_push)
|
|||
nano::test::system system0;
|
||||
nano::test::system system1;
|
||||
nano::node_config config0 (system.get_available_port ());
|
||||
config0.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config0.backlog_population.enable = false;
|
||||
auto node0 (system0.add_node (config0));
|
||||
nano::node_config config1 (system.get_available_port ());
|
||||
config1.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config1.backlog_population.enable = false;
|
||||
auto node1 (system1.add_node (config1));
|
||||
nano::keypair key0;
|
||||
// node0 knows about send0 but node1 doesn't.
|
||||
|
|
@ -1823,7 +1823,7 @@ TEST (node, DISABLED_local_votes_cache)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
node_config.receive_minimum = nano::dev::constants.genesis_amount;
|
||||
auto & node (*system.add_node (node_config));
|
||||
nano::state_block_builder builder;
|
||||
|
|
@ -1907,7 +1907,7 @@ TEST (node, DISABLED_local_votes_cache_batch)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node (*system.add_node (node_config));
|
||||
ASSERT_GE (node.network_params.voting.max_cache, 2);
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
|
@ -1981,7 +1981,7 @@ TEST (node, DISABLED_local_votes_cache_generate_new_vote)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node (*system.add_node (node_config));
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
||||
|
|
@ -2035,7 +2035,7 @@ TEST (node, DISABLED_local_votes_cache_fork)
|
|||
node_flags.disable_legacy_bootstrap = true;
|
||||
node_flags.disable_wallet_bootstrap = true;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node1 (*system.add_node (node_config, node_flags));
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
auto send1 = nano::state_block_builder ()
|
||||
|
|
@ -2284,7 +2284,7 @@ TEST (node, epoch_conflict_confirm)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node0 = *system.add_node (node_config);
|
||||
node_config.peering_port = system.get_available_port ();
|
||||
auto & node1 = *system.add_node (node_config);
|
||||
|
|
@ -2792,7 +2792,7 @@ TEST (node, bidirectional_tcp)
|
|||
node_flags.disable_lazy_bootstrap = true;
|
||||
node_flags.disable_wallet_bootstrap = true;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node1 = system.add_node (node_config, node_flags);
|
||||
node_config.peering_port = system.get_available_port ();
|
||||
node_config.tcp_incoming_connections_max = 0; // Disable incoming TCP connections for node 2
|
||||
|
|
@ -2985,7 +2985,7 @@ TEST (node, rollback_gap_source)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (node_config);
|
||||
nano::state_block_builder builder;
|
||||
nano::keypair key;
|
||||
|
|
@ -3053,7 +3053,7 @@ TEST (node, dependency_graph)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config (system.get_available_port ());
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (config);
|
||||
|
||||
nano::state_block_builder builder;
|
||||
|
|
@ -3251,10 +3251,10 @@ TEST (node, dependency_graph_frontier)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config (system.get_available_port ());
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto & node1 = *system.add_node (config);
|
||||
config.peering_port = system.get_available_port ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::always;
|
||||
config.backlog_population.enable = true;
|
||||
auto & node2 = *system.add_node (config);
|
||||
|
||||
nano::state_block_builder builder;
|
||||
|
|
@ -3418,9 +3418,9 @@ TEST (node, deferred_dependent_elections)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config_1{ system.get_available_port () };
|
||||
node_config_1.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config_1.backlog_population.enable = false;
|
||||
nano::node_config node_config_2{ system.get_available_port () };
|
||||
node_config_2.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config_2.backlog_population.enable = false;
|
||||
nano::node_flags flags;
|
||||
flags.disable_request_loop = true;
|
||||
auto & node = *system.add_node (node_config_1, flags);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ TEST (optimistic_scheduler, under_gap_threshold)
|
|||
{
|
||||
nano::test::system system{};
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (config);
|
||||
|
||||
// Must be smaller than optimistic scheduler `gap_threshold`
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ TEST (request_aggregator, one)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node (*system.add_node (node_config));
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
nano::block_builder builder;
|
||||
|
|
@ -70,7 +70,7 @@ TEST (request_aggregator, one_update)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node (*system.add_node (node_config));
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
nano::keypair key1;
|
||||
|
|
@ -136,7 +136,7 @@ TEST (request_aggregator, two)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node (*system.add_node (node_config));
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
nano::keypair key1;
|
||||
|
|
@ -207,7 +207,7 @@ TEST (request_aggregator, two_endpoints)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
node_flags.disable_rep_crawler = true;
|
||||
auto & node1 (*system.add_node (node_config, node_flags));
|
||||
|
|
@ -265,7 +265,7 @@ TEST (request_aggregator, split)
|
|||
size_t max_vbh = nano::network::confirm_ack_hashes_max;
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node (*system.add_node (node_config));
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
std::vector<std::pair<nano::block_hash, nano::root>> request;
|
||||
|
|
@ -318,7 +318,7 @@ TEST (request_aggregator, channel_max_queue)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
node_config.request_aggregator.max_queue = 0;
|
||||
auto & node (*system.add_node (node_config));
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
|
@ -348,7 +348,7 @@ TEST (request_aggregator, DISABLED_unique)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node (*system.add_node (node_config));
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
nano::block_builder builder;
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ TEST (toml, daemon_config_deserialize_defaults)
|
|||
std::stringstream ss;
|
||||
ss << R"toml(
|
||||
[node]
|
||||
[node.backlog_population]
|
||||
[node.bootstrap_ascending]
|
||||
[node.bootstrap_server]
|
||||
[node.block_processor]
|
||||
|
|
@ -197,8 +198,9 @@ TEST (toml, daemon_config_deserialize_defaults)
|
|||
ASSERT_EQ (conf.node.max_queued_requests, defaults.node.max_queued_requests);
|
||||
ASSERT_EQ (conf.node.request_aggregator_threads, defaults.node.request_aggregator_threads);
|
||||
ASSERT_EQ (conf.node.max_unchecked_blocks, defaults.node.max_unchecked_blocks);
|
||||
ASSERT_EQ (conf.node.backlog_scan_batch_size, defaults.node.backlog_scan_batch_size);
|
||||
ASSERT_EQ (conf.node.backlog_scan_frequency, defaults.node.backlog_scan_frequency);
|
||||
ASSERT_EQ (conf.node.backlog_population.enable, defaults.node.backlog_population.enable);
|
||||
ASSERT_EQ (conf.node.backlog_population.batch_size, defaults.node.backlog_population.batch_size);
|
||||
ASSERT_EQ (conf.node.backlog_population.frequency, defaults.node.backlog_population.frequency);
|
||||
ASSERT_EQ (conf.node.enable_upnp, defaults.node.enable_upnp);
|
||||
|
||||
ASSERT_EQ (conf.node.websocket_config.enabled, defaults.node.websocket_config.enabled);
|
||||
|
|
@ -462,10 +464,13 @@ TEST (toml, daemon_config_deserialize_no_defaults)
|
|||
request_aggregator_threads = 999
|
||||
max_unchecked_blocks = 999
|
||||
frontiers_confirmation = "always"
|
||||
backlog_scan_batch_size = 999
|
||||
backlog_scan_frequency = 999
|
||||
enable_upnp = false
|
||||
|
||||
[node.backlog_population]
|
||||
enable = false
|
||||
batch_size = 999
|
||||
frequency = 999
|
||||
|
||||
[node.block_processor]
|
||||
max_peer_queue = 999
|
||||
max_system_queue = 999
|
||||
|
|
@ -673,7 +678,6 @@ TEST (toml, daemon_config_deserialize_no_defaults)
|
|||
ASSERT_NE (conf.node.io_threads, defaults.node.io_threads);
|
||||
ASSERT_NE (conf.node.max_work_generate_multiplier, defaults.node.max_work_generate_multiplier);
|
||||
ASSERT_NE (conf.node.max_unchecked_blocks, defaults.node.max_unchecked_blocks);
|
||||
ASSERT_NE (conf.node.frontiers_confirmation, defaults.node.frontiers_confirmation);
|
||||
ASSERT_NE (conf.node.network_threads, defaults.node.network_threads);
|
||||
ASSERT_NE (conf.node.background_threads, defaults.node.background_threads);
|
||||
ASSERT_NE (conf.node.secondary_work_peers, defaults.node.secondary_work_peers);
|
||||
|
|
@ -700,8 +704,9 @@ TEST (toml, daemon_config_deserialize_no_defaults)
|
|||
ASSERT_NE (conf.node.work_threads, defaults.node.work_threads);
|
||||
ASSERT_NE (conf.node.max_queued_requests, defaults.node.max_queued_requests);
|
||||
ASSERT_NE (conf.node.request_aggregator_threads, defaults.node.request_aggregator_threads);
|
||||
ASSERT_NE (conf.node.backlog_scan_batch_size, defaults.node.backlog_scan_batch_size);
|
||||
ASSERT_NE (conf.node.backlog_scan_frequency, defaults.node.backlog_scan_frequency);
|
||||
ASSERT_NE (conf.node.backlog_population.enable, defaults.node.backlog_population.enable);
|
||||
ASSERT_NE (conf.node.backlog_population.batch_size, defaults.node.backlog_population.batch_size);
|
||||
ASSERT_NE (conf.node.backlog_population.frequency, defaults.node.backlog_population.frequency);
|
||||
ASSERT_NE (conf.node.enable_upnp, defaults.node.enable_upnp);
|
||||
|
||||
ASSERT_NE (conf.node.websocket_config.enabled, defaults.node.websocket_config.enabled);
|
||||
|
|
@ -909,23 +914,6 @@ TEST (toml, daemon_config_deserialize_errors)
|
|||
|
||||
ASSERT_EQ (toml.get_error ().get_message (), "max_work_generate_multiplier must be greater than or equal to 1");
|
||||
}
|
||||
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << R"toml(
|
||||
[node]
|
||||
frontiers_confirmation = "randomstring"
|
||||
)toml";
|
||||
|
||||
nano::tomlconfig toml;
|
||||
toml.read (ss);
|
||||
nano::daemon_config conf;
|
||||
conf.deserialize_toml (toml);
|
||||
|
||||
ASSERT_EQ (toml.get_error ().get_message (), "frontiers_confirmation value is invalid (available: always, auto, disabled)");
|
||||
ASSERT_EQ (conf.node.frontiers_confirmation, nano::frontiers_confirmation_mode::invalid);
|
||||
}
|
||||
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << R"toml(
|
||||
|
|
@ -1090,7 +1078,7 @@ TEST (toml, merge_config_files)
|
|||
ss << R"toml(
|
||||
[node]
|
||||
active_elections.size = 999
|
||||
# backlog_scan_batch_size = 7777
|
||||
# background_threads = 7777
|
||||
[node.bootstrap_ascending]
|
||||
block_processor_threshold = 33333
|
||||
old_entry = 34
|
||||
|
|
@ -1114,7 +1102,7 @@ TEST (toml, merge_config_files)
|
|||
|
||||
ASSERT_NE (merged_config.node.active_elections.size, default_config.node.active_elections.size);
|
||||
ASSERT_EQ (merged_config.node.active_elections.size, 999);
|
||||
ASSERT_NE (merged_config.node.backlog_scan_batch_size, 7777);
|
||||
ASSERT_NE (merged_config.node.background_threads, 7777);
|
||||
ASSERT_EQ (merged_config.node.bootstrap_ascending.block_processor_threshold, 33333);
|
||||
ASSERT_TRUE (merged_config_string.find ("old_entry") == std::string::npos);
|
||||
}
|
||||
|
|
@ -19,7 +19,7 @@ TEST (vote_processor, codes)
|
|||
nano::test::system system;
|
||||
auto node_config = system.default_config ();
|
||||
// Disable all election schedulers
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
node_config.hinted_scheduler.enabled = false;
|
||||
node_config.optimistic_scheduler.enabled = false;
|
||||
auto & node = *system.add_node (node_config);
|
||||
|
|
@ -157,10 +157,10 @@ TEST (vote_processor, no_broadcast_local)
|
|||
flags.disable_request_loop = true;
|
||||
nano::node_config config1, config2;
|
||||
config1.representative_vote_weight_minimum = 0;
|
||||
config1.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config1.backlog_population.enable = false;
|
||||
auto & node (*system.add_node (config1, flags));
|
||||
config2.representative_vote_weight_minimum = 0;
|
||||
config2.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config2.backlog_population.enable = false;
|
||||
config2.peering_port = system.get_available_port ();
|
||||
system.add_node (config2, flags);
|
||||
nano::block_builder builder;
|
||||
|
|
@ -212,10 +212,10 @@ TEST (vote_processor, local_broadcast_without_a_representative)
|
|||
flags.disable_request_loop = true;
|
||||
nano::node_config config1, config2;
|
||||
config1.representative_vote_weight_minimum = 0;
|
||||
config1.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config1.backlog_population.enable = false;
|
||||
auto & node (*system.add_node (config1, flags));
|
||||
config2.representative_vote_weight_minimum = 0;
|
||||
config2.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config2.backlog_population.enable = false;
|
||||
config2.peering_port = system.get_available_port ();
|
||||
system.add_node (config2, flags);
|
||||
nano::block_builder builder;
|
||||
|
|
@ -261,9 +261,9 @@ TEST (vote_processor, no_broadcast_local_with_a_principal_representative)
|
|||
nano::node_flags flags;
|
||||
flags.disable_request_loop = true;
|
||||
nano::node_config config1, config2;
|
||||
config1.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config1.backlog_population.enable = false;
|
||||
auto & node (*system.add_node (config1, flags));
|
||||
config2.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config2.backlog_population.enable = false;
|
||||
config2.peering_port = system.get_available_port ();
|
||||
system.add_node (config2, flags);
|
||||
nano::block_builder builder;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ TEST (vote_spacing, prune)
|
|||
TEST (vote_spacing, vote_generator)
|
||||
{
|
||||
nano::node_config config;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
config.active_elections.hinted_limit_percentage = 0; // Disable election hinting
|
||||
nano::test::system system;
|
||||
nano::node_flags node_flags;
|
||||
|
|
@ -189,7 +189,7 @@ TEST (vote_spacing, vote_generator)
|
|||
TEST (vote_spacing, rapid)
|
||||
{
|
||||
nano::node_config config;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
config.active_elections.hinted_limit_percentage = 0; // Disable election hinting
|
||||
nano::test::system system;
|
||||
nano::node_flags node_flags;
|
||||
|
|
|
|||
|
|
@ -1149,7 +1149,7 @@ TEST (wallet, search_receivable)
|
|||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.enable_voting = false;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags flags;
|
||||
flags.disable_search_pending = true;
|
||||
auto & node (*system.add_node (config, flags));
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ TEST (wallets, search_receivable)
|
|||
nano::test::system system;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.enable_voting = false;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags flags;
|
||||
flags.disable_search_pending = true;
|
||||
auto & node (*system.add_node (config, flags));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <nano/core_test/fakes/websocket_client.hpp>
|
||||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/telemetry.hpp>
|
||||
#include <nano/node/transport/fake.hpp>
|
||||
#include <nano/node/vote_router.hpp>
|
||||
#include <nano/node/websocket.hpp>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
#include <limits>
|
||||
|
||||
/*
|
||||
* token_bucket
|
||||
*/
|
||||
|
||||
nano::rate::token_bucket::token_bucket (std::size_t max_token_count_a, std::size_t refill_rate_a)
|
||||
{
|
||||
reset (max_token_count_a, refill_rate_a);
|
||||
|
|
@ -12,7 +16,6 @@ nano::rate::token_bucket::token_bucket (std::size_t max_token_count_a, std::size
|
|||
bool nano::rate::token_bucket::try_consume (unsigned tokens_required_a)
|
||||
{
|
||||
debug_assert (tokens_required_a <= 1e9);
|
||||
nano::lock_guard<nano::mutex> guard{ mutex };
|
||||
refill ();
|
||||
bool possible = current_size >= tokens_required_a;
|
||||
if (possible)
|
||||
|
|
@ -44,14 +47,11 @@ void nano::rate::token_bucket::refill ()
|
|||
|
||||
std::size_t nano::rate::token_bucket::largest_burst () const
|
||||
{
|
||||
nano::lock_guard<nano::mutex> guard{ mutex };
|
||||
return max_token_count - smallest_size;
|
||||
}
|
||||
|
||||
void nano::rate::token_bucket::reset (std::size_t max_token_count_a, std::size_t refill_rate_a)
|
||||
{
|
||||
nano::lock_guard<nano::mutex> guard{ mutex };
|
||||
|
||||
// A token count of 0 indicates unlimited capacity. We use 1e9 as
|
||||
// a sentinel, allowing largest burst to still be computed.
|
||||
if (max_token_count_a == 0 || refill_rate_a == 0)
|
||||
|
|
@ -62,3 +62,24 @@ void nano::rate::token_bucket::reset (std::size_t max_token_count_a, std::size_t
|
|||
refill_rate = refill_rate_a;
|
||||
last_refill = std::chrono::steady_clock::now ();
|
||||
}
|
||||
|
||||
/*
|
||||
* rate_limiter
|
||||
*/
|
||||
|
||||
nano::rate_limiter::rate_limiter (std::size_t limit_a, double burst_ratio_a) :
|
||||
bucket (static_cast<std::size_t> (limit_a * burst_ratio_a), limit_a)
|
||||
{
|
||||
}
|
||||
|
||||
bool nano::rate_limiter::should_pass (std::size_t message_size_a)
|
||||
{
|
||||
nano::lock_guard<nano::mutex> guard{ mutex };
|
||||
return bucket.try_consume (nano::narrow_cast<unsigned int> (message_size_a));
|
||||
}
|
||||
|
||||
void nano::rate_limiter::reset (std::size_t limit_a, double burst_ratio_a)
|
||||
{
|
||||
nano::lock_guard<nano::mutex> guard{ mutex };
|
||||
bucket.reset (static_cast<std::size_t> (limit_a * burst_ratio_a), limit_a);
|
||||
}
|
||||
|
|
@ -4,61 +4,73 @@
|
|||
#include <chrono>
|
||||
#include <mutex>
|
||||
|
||||
/* Namespace for shaping (egress) and policing (ingress) rate limiting algorithms */
|
||||
namespace nano::rate
|
||||
{
|
||||
/**
|
||||
* Token bucket based rate limiting. This is suitable for rate limiting ipc/api calls
|
||||
* and network traffic, while allowing short bursts.
|
||||
*
|
||||
* Tokens are refilled at N tokens per second and there's a bucket capacity to limit
|
||||
* bursts.
|
||||
*
|
||||
* A bucket has low overhead and can be instantiated for various purposes, such as one
|
||||
* bucket per session, or one for bandwidth limiting. A token can represent bytes,
|
||||
* messages, or the cost of API invocations.
|
||||
*/
|
||||
class token_bucket
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Set up a token bucket.
|
||||
* @param max_token_count Maximum number of tokens in this bucket, which limits bursts.
|
||||
* @param refill_rate Token refill rate, which limits the long term rate (tokens per seconds)
|
||||
*/
|
||||
token_bucket (std::size_t max_token_count, std::size_t refill_rate);
|
||||
|
||||
/**
|
||||
* Determine if an operation of cost \p tokens_required is possible, and deduct from the
|
||||
* bucket if that's the case.
|
||||
* The default cost is 1 token, but resource intensive operations may request
|
||||
* more tokens to be available.
|
||||
*/
|
||||
bool try_consume (unsigned tokens_required = 1);
|
||||
|
||||
/** Returns the largest burst observed */
|
||||
std::size_t largest_burst () const;
|
||||
|
||||
/** Update the max_token_count and/or refill_rate_a parameters */
|
||||
void reset (std::size_t max_token_count, std::size_t refill_rate);
|
||||
|
||||
private:
|
||||
void refill ();
|
||||
|
||||
private:
|
||||
std::size_t max_token_count;
|
||||
std::size_t refill_rate;
|
||||
|
||||
std::size_t current_size{ 0 };
|
||||
/** The minimum observed bucket size, from which the largest burst can be derived */
|
||||
std::size_t smallest_size{ 0 };
|
||||
std::chrono::steady_clock::time_point last_refill;
|
||||
|
||||
static std::size_t constexpr unlimited_rate_sentinel{ static_cast<std::size_t> (1e9) };
|
||||
};
|
||||
}
|
||||
|
||||
namespace nano
|
||||
{
|
||||
/* Namespace for shaping (egress) and policing (ingress) rate limiting algorithms */
|
||||
namespace rate
|
||||
class rate_limiter final
|
||||
{
|
||||
/**
|
||||
* Token bucket based rate limiting. This is suitable for rate limiting ipc/api calls
|
||||
* and network traffic, while allowing short bursts.
|
||||
*
|
||||
* Tokens are refilled at N tokens per second and there's a bucket capacity to limit
|
||||
* bursts.
|
||||
*
|
||||
* A bucket has low overhead and can be instantiated for various purposes, such as one
|
||||
* bucket per session, or one for bandwidth limiting. A token can represent bytes,
|
||||
* messages, or the cost of API invocations.
|
||||
*/
|
||||
class token_bucket
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Set up a token bucket.
|
||||
* @param max_token_count Maximum number of tokens in this bucket, which limits bursts.
|
||||
* @param refill_rate Token refill rate, which limits the long term rate (tokens per seconds)
|
||||
*/
|
||||
token_bucket (std::size_t max_token_count, std::size_t refill_rate);
|
||||
public:
|
||||
// initialize with limit 0 = unbounded
|
||||
rate_limiter (std::size_t limit, double burst_ratio);
|
||||
|
||||
/**
|
||||
* Determine if an operation of cost \p tokens_required is possible, and deduct from the
|
||||
* bucket if that's the case.
|
||||
* The default cost is 1 token, but resource intensive operations may request
|
||||
* more tokens to be available.
|
||||
*/
|
||||
bool try_consume (unsigned tokens_required = 1);
|
||||
bool should_pass (std::size_t buffer_size);
|
||||
void reset (std::size_t limit, double burst_ratio);
|
||||
|
||||
/** Returns the largest burst observed */
|
||||
std::size_t largest_burst () const;
|
||||
|
||||
/** Update the max_token_count and/or refill_rate_a parameters */
|
||||
void reset (std::size_t max_token_count, std::size_t refill_rate);
|
||||
|
||||
private:
|
||||
void refill ();
|
||||
|
||||
private:
|
||||
std::size_t max_token_count;
|
||||
std::size_t refill_rate;
|
||||
|
||||
std::size_t current_size{ 0 };
|
||||
/** The minimum observed bucket size, from which the largest burst can be derived */
|
||||
std::size_t smallest_size{ 0 };
|
||||
std::chrono::steady_clock::time_point last_refill;
|
||||
|
||||
mutable nano::mutex mutex;
|
||||
|
||||
static std::size_t constexpr unlimited_rate_sentinel{ static_cast<std::size_t> (1e9) };
|
||||
};
|
||||
}
|
||||
}
|
||||
private:
|
||||
nano::rate::token_bucket bucket;
|
||||
mutable nano::mutex mutex;
|
||||
};
|
||||
}
|
||||
|
|
@ -1278,7 +1278,6 @@ int main (int argc, char * const * argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
config2.frontiers_confirmation = daemon_config.node.frontiers_confirmation;
|
||||
config2.active_elections.size = daemon_config.node.active_elections.size;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
#include <nano/store/component.hpp>
|
||||
#include <nano/store/confirmation_height.hpp>
|
||||
|
||||
nano::backlog_population::backlog_population (const config & config_a, nano::scheduler::component & schedulers, nano::ledger & ledger, nano::stats & stats_a) :
|
||||
config_m{ config_a },
|
||||
nano::backlog_population::backlog_population (backlog_population_config const & config_a, nano::scheduler::component & schedulers, nano::ledger & ledger, nano::stats & stats_a) :
|
||||
config{ config_a },
|
||||
schedulers{ schedulers },
|
||||
ledger{ ledger },
|
||||
stats{ stats_a }
|
||||
|
|
@ -58,7 +58,7 @@ void nano::backlog_population::notify ()
|
|||
|
||||
bool nano::backlog_population::predicate () const
|
||||
{
|
||||
return triggered || config_m.enabled;
|
||||
return triggered || config.enable;
|
||||
}
|
||||
|
||||
void nano::backlog_population::run ()
|
||||
|
|
@ -82,9 +82,9 @@ void nano::backlog_population::run ()
|
|||
|
||||
void nano::backlog_population::populate_backlog (nano::unique_lock<nano::mutex> & lock)
|
||||
{
|
||||
debug_assert (config_m.frequency > 0);
|
||||
debug_assert (config.frequency > 0);
|
||||
|
||||
const auto chunk_size = config_m.batch_size / config_m.frequency;
|
||||
const auto chunk_size = config.batch_size / config.frequency;
|
||||
auto done = false;
|
||||
nano::account next = 0;
|
||||
uint64_t total = 0;
|
||||
|
|
@ -121,7 +121,7 @@ void nano::backlog_population::populate_backlog (nano::unique_lock<nano::mutex>
|
|||
lock.lock ();
|
||||
|
||||
// Give the rest of the node time to progress without holding database lock
|
||||
condition.wait_for (lock, std::chrono::milliseconds{ 1000 / config_m.frequency });
|
||||
condition.wait_for (lock, std::chrono::milliseconds{ 1000 / config.frequency });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,3 +141,25 @@ void nano::backlog_population::activate (secure::transaction const & transaction
|
|||
schedulers.priority.activate (transaction, account, account_info, conf_info);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* backlog_population_config
|
||||
*/
|
||||
|
||||
nano::error nano::backlog_population_config::serialize (nano::tomlconfig & toml) const
|
||||
{
|
||||
toml.put ("enable", enable, "Control if ongoing backlog population is enabled. If not, backlog population can still be triggered by RPC \ntype:bool");
|
||||
toml.put ("batch_size", batch_size, "Number of accounts per second to process when doing backlog population scan. Increasing this value will help unconfirmed frontiers get into election prioritization queue faster, however it will also increase resource usage. \ntype:uint");
|
||||
toml.put ("frequency", frequency, "Backlog scan divides the scan into smaller batches, number of which is controlled by this value. Higher frequency helps to utilize resources more uniformly, however it also introduces more overhead. The resulting number of accounts per single batch is `backlog_scan_batch_size / backlog_scan_frequency` \ntype:uint");
|
||||
|
||||
return toml.get_error ();
|
||||
}
|
||||
|
||||
nano::error nano::backlog_population_config::deserialize (nano::tomlconfig & toml)
|
||||
{
|
||||
toml.get ("enable", enable);
|
||||
toml.get ("batch_size", batch_size);
|
||||
toml.get ("frequency", frequency);
|
||||
|
||||
return toml.get_error ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,22 +20,25 @@ class election_scheduler;
|
|||
class ledger;
|
||||
class stats;
|
||||
|
||||
class backlog_population_config final
|
||||
{
|
||||
public:
|
||||
nano::error deserialize (nano::tomlconfig &);
|
||||
nano::error serialize (nano::tomlconfig &) const;
|
||||
|
||||
public:
|
||||
/** Control if ongoing backlog population is enabled. If not, backlog population can still be triggered by RPC */
|
||||
bool enable{ true };
|
||||
/** Number of accounts per second to process. Number of accounts per single batch is this value divided by `frequency` */
|
||||
unsigned batch_size{ 10 * 1000 };
|
||||
/** Number of batches to run per second. Batches run in 1 second / `frequency` intervals */
|
||||
unsigned frequency{ 10 };
|
||||
};
|
||||
|
||||
class backlog_population final
|
||||
{
|
||||
public:
|
||||
struct config
|
||||
{
|
||||
/** Control if ongoing backlog population is enabled. If not, backlog population can still be triggered by RPC */
|
||||
bool enabled;
|
||||
|
||||
/** Number of accounts per second to process. Number of accounts per single batch is this value divided by `frequency` */
|
||||
unsigned batch_size;
|
||||
|
||||
/** Number of batches to run per second. Batches run in 1 second / `frequency` intervals */
|
||||
unsigned frequency;
|
||||
};
|
||||
|
||||
backlog_population (const config &, nano::scheduler::component &, nano::ledger &, nano::stats &);
|
||||
backlog_population (backlog_population_config const &, nano::scheduler::component &, nano::ledger &, nano::stats &);
|
||||
~backlog_population ();
|
||||
|
||||
void start ();
|
||||
|
|
@ -55,19 +58,18 @@ public:
|
|||
callback_t activate_callback;
|
||||
|
||||
private: // Dependencies
|
||||
backlog_population_config const & config;
|
||||
nano::scheduler::component & schedulers;
|
||||
nano::ledger & ledger;
|
||||
nano::stats & stats;
|
||||
|
||||
config config_m;
|
||||
|
||||
private:
|
||||
void run ();
|
||||
bool predicate () const;
|
||||
|
||||
void populate_backlog (nano::unique_lock<nano::mutex> & lock);
|
||||
void activate (secure::transaction const &, nano::account const &, nano::account_info const &);
|
||||
|
||||
private:
|
||||
/** This is a manual trigger, the ongoing backlog population does not use this.
|
||||
* It can be triggered even when backlog population (frontiers confirmation) is disabled. */
|
||||
bool triggered{ false };
|
||||
|
|
|
|||
|
|
@ -1,74 +1,54 @@
|
|||
#include <nano/lib/utility.hpp>
|
||||
#include <nano/node/bandwidth_limiter.hpp>
|
||||
#include <nano/node/nodeconfig.hpp>
|
||||
|
||||
/*
|
||||
* bandwidth_limiter
|
||||
*/
|
||||
|
||||
nano::bandwidth_limiter::bandwidth_limiter (std::size_t limit_a, double burst_ratio_a) :
|
||||
bucket (static_cast<std::size_t> (limit_a * burst_ratio_a), limit_a)
|
||||
nano::bandwidth_limiter::bandwidth_limiter (nano::node_config const & node_config_a) :
|
||||
config{ node_config_a },
|
||||
limiter_generic{ config.generic_limit, config.generic_burst_ratio },
|
||||
limiter_bootstrap{ config.bootstrap_limit, config.bootstrap_burst_ratio }
|
||||
{
|
||||
}
|
||||
|
||||
bool nano::bandwidth_limiter::should_pass (std::size_t message_size_a)
|
||||
{
|
||||
return bucket.try_consume (nano::narrow_cast<unsigned int> (message_size_a));
|
||||
}
|
||||
|
||||
void nano::bandwidth_limiter::reset (std::size_t limit_a, double burst_ratio_a)
|
||||
{
|
||||
bucket.reset (static_cast<std::size_t> (limit_a * burst_ratio_a), limit_a);
|
||||
}
|
||||
|
||||
/*
|
||||
* outbound_bandwidth_limiter
|
||||
*/
|
||||
|
||||
nano::outbound_bandwidth_limiter::outbound_bandwidth_limiter (nano::outbound_bandwidth_limiter::config config_a) :
|
||||
config_m{ config_a },
|
||||
limiter_standard (config_m.standard_limit, config_m.standard_burst_ratio),
|
||||
limiter_bootstrap{ config_m.bootstrap_limit, config_m.bootstrap_burst_ratio }
|
||||
{
|
||||
}
|
||||
|
||||
nano::bandwidth_limiter & nano::outbound_bandwidth_limiter::select_limiter (nano::bandwidth_limit_type type)
|
||||
nano::rate_limiter & nano::bandwidth_limiter::select_limiter (nano::transport::traffic_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case bandwidth_limit_type::bootstrap:
|
||||
case nano::transport::traffic_type::bootstrap:
|
||||
return limiter_bootstrap;
|
||||
case bandwidth_limit_type::standard:
|
||||
case nano::transport::traffic_type::generic:
|
||||
return limiter_generic;
|
||||
break;
|
||||
default:
|
||||
debug_assert (false);
|
||||
debug_assert (false, "missing traffic type");
|
||||
break;
|
||||
}
|
||||
return limiter_standard;
|
||||
return limiter_generic;
|
||||
}
|
||||
|
||||
bool nano::outbound_bandwidth_limiter::should_pass (std::size_t buffer_size, nano::bandwidth_limit_type type)
|
||||
bool nano::bandwidth_limiter::should_pass (std::size_t buffer_size, nano::transport::traffic_type type)
|
||||
{
|
||||
auto & limiter = select_limiter (type);
|
||||
return limiter.should_pass (buffer_size);
|
||||
}
|
||||
|
||||
void nano::outbound_bandwidth_limiter::reset (std::size_t limit, double burst_ratio, nano::bandwidth_limit_type type)
|
||||
void nano::bandwidth_limiter::reset (std::size_t limit, double burst_ratio, nano::transport::traffic_type type)
|
||||
{
|
||||
auto & limiter = select_limiter (type);
|
||||
limiter.reset (limit, burst_ratio);
|
||||
}
|
||||
|
||||
nano::bandwidth_limit_type nano::to_bandwidth_limit_type (const nano::transport::traffic_type & traffic_type)
|
||||
/*
|
||||
* bandwidth_limiter_config
|
||||
*/
|
||||
|
||||
nano::bandwidth_limiter_config::bandwidth_limiter_config (nano::node_config const & node_config) :
|
||||
generic_limit{ node_config.bandwidth_limit },
|
||||
generic_burst_ratio{ node_config.bandwidth_limit_burst_ratio },
|
||||
bootstrap_limit{ node_config.bootstrap_bandwidth_limit },
|
||||
bootstrap_burst_ratio{ node_config.bootstrap_bandwidth_burst_ratio }
|
||||
{
|
||||
switch (traffic_type)
|
||||
{
|
||||
case nano::transport::traffic_type::generic:
|
||||
return nano::bandwidth_limit_type::standard;
|
||||
break;
|
||||
case nano::transport::traffic_type::bootstrap:
|
||||
return nano::bandwidth_limit_type::bootstrap;
|
||||
break;
|
||||
}
|
||||
debug_assert (false);
|
||||
return {};
|
||||
}
|
||||
|
|
@ -1,22 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include <nano/lib/rate_limiting.hpp>
|
||||
#include <nano/node/fwd.hpp>
|
||||
#include <nano/node/transport/traffic_type.hpp>
|
||||
|
||||
namespace nano
|
||||
{
|
||||
/**
|
||||
* Enumeration for different bandwidth limits for different traffic types
|
||||
*/
|
||||
enum class bandwidth_limit_type
|
||||
class bandwidth_limiter_config final
|
||||
{
|
||||
/** For all message */
|
||||
standard,
|
||||
/** For bootstrap (asc_pull_ack, asc_pull_req) traffic */
|
||||
bootstrap
|
||||
};
|
||||
public:
|
||||
explicit bandwidth_limiter_config (nano::node_config const &);
|
||||
|
||||
nano::bandwidth_limit_type to_bandwidth_limit_type (nano::transport::traffic_type const &);
|
||||
public:
|
||||
std::size_t generic_limit;
|
||||
double generic_burst_ratio;
|
||||
|
||||
std::size_t bootstrap_limit;
|
||||
double bootstrap_burst_ratio;
|
||||
};
|
||||
|
||||
/**
|
||||
* Class that tracks and manages bandwidth limits for IO operations
|
||||
|
|
@ -24,53 +25,29 @@ nano::bandwidth_limit_type to_bandwidth_limit_type (nano::transport::traffic_typ
|
|||
class bandwidth_limiter final
|
||||
{
|
||||
public:
|
||||
// initialize with limit 0 = unbounded
|
||||
bandwidth_limiter (std::size_t limit, double burst_ratio);
|
||||
|
||||
bool should_pass (std::size_t buffer_size);
|
||||
void reset (std::size_t limit, double burst_ratio);
|
||||
|
||||
private:
|
||||
nano::rate::token_bucket bucket;
|
||||
};
|
||||
|
||||
class outbound_bandwidth_limiter final
|
||||
{
|
||||
public: // Config
|
||||
struct config
|
||||
{
|
||||
// standard
|
||||
std::size_t standard_limit;
|
||||
double standard_burst_ratio;
|
||||
// bootstrap
|
||||
std::size_t bootstrap_limit;
|
||||
double bootstrap_burst_ratio;
|
||||
};
|
||||
|
||||
public:
|
||||
explicit outbound_bandwidth_limiter (config);
|
||||
explicit bandwidth_limiter (nano::node_config const &);
|
||||
|
||||
/**
|
||||
* Check whether packet falls withing bandwidth limits and should be allowed
|
||||
* @return true if OK, false if needs to be dropped
|
||||
*/
|
||||
bool should_pass (std::size_t buffer_size, bandwidth_limit_type);
|
||||
bool should_pass (std::size_t buffer_size, nano::transport::traffic_type type);
|
||||
/**
|
||||
* Reset limits of selected limiter type to values passed in arguments
|
||||
*/
|
||||
void reset (std::size_t limit, double burst_ratio, bandwidth_limit_type = bandwidth_limit_type::standard);
|
||||
void reset (std::size_t limit, double burst_ratio, nano::transport::traffic_type type = nano::transport::traffic_type::generic);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns reference to limiter corresponding to the limit type
|
||||
*/
|
||||
bandwidth_limiter & select_limiter (bandwidth_limit_type);
|
||||
nano::rate_limiter & select_limiter (nano::transport::traffic_type type);
|
||||
|
||||
private:
|
||||
const config config_m;
|
||||
bandwidth_limiter_config const config;
|
||||
|
||||
private:
|
||||
bandwidth_limiter limiter_standard;
|
||||
bandwidth_limiter limiter_bootstrap;
|
||||
nano::rate_limiter limiter_generic;
|
||||
nano::rate_limiter limiter_bootstrap;
|
||||
};
|
||||
}
|
||||
|
|
@ -4,8 +4,7 @@
|
|||
#include <nano/lib/locks.hpp>
|
||||
#include <nano/lib/numbers.hpp>
|
||||
#include <nano/lib/observer_set.hpp>
|
||||
#include <nano/lib/timer.hpp>
|
||||
#include <nano/node/bandwidth_limiter.hpp>
|
||||
#include <nano/lib/rate_limiting.hpp>
|
||||
#include <nano/node/bootstrap/bootstrap_config.hpp>
|
||||
#include <nano/node/bootstrap_ascending/account_sets.hpp>
|
||||
#include <nano/node/bootstrap_ascending/common.hpp>
|
||||
|
|
@ -181,7 +180,7 @@ namespace bootstrap_ascending
|
|||
|
||||
// Requests for accounts from database have much lower hitrate and could introduce strain on the network
|
||||
// A separate (lower) limiter ensures that we always reserve resources for querying accounts from priority queue
|
||||
nano::bandwidth_limiter database_limiter;
|
||||
nano::rate_limiter database_limiter;
|
||||
|
||||
nano::interval sync_dependencies_interval;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <nano/lib/blocks.hpp>
|
||||
#include <nano/lib/locks.hpp>
|
||||
#include <nano/lib/processing_queue.hpp>
|
||||
#include <nano/node/bandwidth_limiter.hpp>
|
||||
#include <nano/lib/rate_limiting.hpp>
|
||||
#include <nano/node/blockprocessor.hpp>
|
||||
#include <nano/node/fwd.hpp>
|
||||
#include <nano/secure/common.hpp>
|
||||
|
|
@ -112,7 +112,7 @@ private:
|
|||
|
||||
private:
|
||||
bool enabled{ false };
|
||||
nano::bandwidth_limiter limiter;
|
||||
nano::rate_limiter limiter;
|
||||
nano::interval cleanup_interval;
|
||||
|
||||
std::atomic<bool> stopped{ false };
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <nano/node/bootstrap_ascending/service.hpp>
|
||||
#include <nano/node/message_processor.hpp>
|
||||
#include <nano/node/node.hpp>
|
||||
#include <nano/node/telemetry.hpp>
|
||||
|
||||
nano::message_processor::message_processor (message_processor_config const & config_a, nano::node & node_a) :
|
||||
config{ config_a },
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@
|
|||
#include <nano/lib/tomlconfig.hpp>
|
||||
#include <nano/lib/utility.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/backlog_population.hpp>
|
||||
#include <nano/node/bandwidth_limiter.hpp>
|
||||
#include <nano/node/bootstrap_ascending/service.hpp>
|
||||
#include <nano/node/common.hpp>
|
||||
#include <nano/node/confirming_set.hpp>
|
||||
|
|
@ -54,90 +56,10 @@ extern unsigned char nano_bootstrap_weights_beta[];
|
|||
extern std::size_t nano_bootstrap_weights_beta_size;
|
||||
}
|
||||
|
||||
/*
|
||||
* configs
|
||||
*/
|
||||
|
||||
nano::backlog_population::config nano::backlog_population_config (const nano::node_config & config)
|
||||
{
|
||||
nano::backlog_population::config cfg{};
|
||||
cfg.enabled = config.frontiers_confirmation != nano::frontiers_confirmation_mode::disabled;
|
||||
cfg.frequency = config.backlog_scan_frequency;
|
||||
cfg.batch_size = config.backlog_scan_batch_size;
|
||||
return cfg;
|
||||
}
|
||||
|
||||
nano::outbound_bandwidth_limiter::config nano::outbound_bandwidth_limiter_config (const nano::node_config & config)
|
||||
{
|
||||
outbound_bandwidth_limiter::config cfg{};
|
||||
cfg.standard_limit = config.bandwidth_limit;
|
||||
cfg.standard_burst_ratio = config.bandwidth_limit_burst_ratio;
|
||||
cfg.bootstrap_limit = config.bootstrap_bandwidth_limit;
|
||||
cfg.bootstrap_burst_ratio = config.bootstrap_bandwidth_burst_ratio;
|
||||
return cfg;
|
||||
}
|
||||
|
||||
/*
|
||||
* node
|
||||
*/
|
||||
|
||||
void nano::node::keepalive (std::string const & address_a, uint16_t port_a)
|
||||
{
|
||||
auto node_l (shared_from_this ());
|
||||
network.resolver.async_resolve (boost::asio::ip::tcp::resolver::query (address_a, std::to_string (port_a)), [node_l, address_a, port_a] (boost::system::error_code const & ec, boost::asio::ip::tcp::resolver::iterator i_a) {
|
||||
if (!ec)
|
||||
{
|
||||
for (auto i (i_a), n (boost::asio::ip::tcp::resolver::iterator{}); i != n; ++i)
|
||||
{
|
||||
auto endpoint (nano::transport::map_endpoint_to_v6 (i->endpoint ()));
|
||||
std::weak_ptr<nano::node> node_w (node_l);
|
||||
auto channel (node_l->network.find_channel (endpoint));
|
||||
if (!channel)
|
||||
{
|
||||
node_l->network.tcp_channels.start_tcp (endpoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
node_l->network.send_keepalive (channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node_l->logger.error (nano::log::type::node, "Error resolving address for keepalive: {}:{} ({})", address_a, port_a, ec.message ());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
nano::keypair nano::load_or_create_node_id (std::filesystem::path const & application_path)
|
||||
{
|
||||
auto node_private_key_path = application_path / "node_id_private.key";
|
||||
std::ifstream ifs (node_private_key_path.c_str ());
|
||||
if (ifs.good ())
|
||||
{
|
||||
nano::default_logger ().info (nano::log::type::init, "Reading node id from: '{}'", node_private_key_path.string ());
|
||||
|
||||
std::string node_private_key;
|
||||
ifs >> node_private_key;
|
||||
release_assert (node_private_key.size () == 64);
|
||||
nano::keypair kp = nano::keypair (node_private_key);
|
||||
return kp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no node_id found, generate new one
|
||||
nano::default_logger ().info (nano::log::type::init, "Generating a new node id, saving to: '{}'", node_private_key_path.string ());
|
||||
|
||||
nano::keypair kp;
|
||||
std::ofstream ofs (node_private_key_path.c_str (), std::ofstream::out | std::ofstream::trunc);
|
||||
ofs << kp.prv.to_string () << std::endl
|
||||
<< std::flush;
|
||||
ofs.close ();
|
||||
release_assert (!ofs.fail ());
|
||||
return kp;
|
||||
}
|
||||
}
|
||||
|
||||
nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, uint16_t peering_port_a, std::filesystem::path const & application_path_a, nano::work_pool & work_a, nano::node_flags flags_a, unsigned seq) :
|
||||
node (io_ctx_a, application_path_a, nano::node_config (peering_port_a), work_a, flags_a, seq)
|
||||
{
|
||||
|
|
@ -168,14 +90,16 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy
|
|||
wallets_store (*wallets_store_impl),
|
||||
ledger_impl{ std::make_unique<nano::ledger> (store, stats, network_params.ledger, flags_a.generate_cache, config_a.representative_vote_weight_minimum.number ()) },
|
||||
ledger{ *ledger_impl },
|
||||
outbound_limiter{ outbound_bandwidth_limiter_config (config) },
|
||||
outbound_limiter_impl{ std::make_unique<nano::bandwidth_limiter> (config) },
|
||||
outbound_limiter{ *outbound_limiter_impl },
|
||||
message_processor_impl{ std::make_unique<nano::message_processor> (config.message_processor, *this) },
|
||||
message_processor{ *message_processor_impl },
|
||||
// empty `config.peering_port` means the user made no port choice at all;
|
||||
// otherwise, any value is considered, with `0` having the special meaning of 'let the OS pick a port instead'
|
||||
//
|
||||
network (*this, config.peering_port.has_value () ? *config.peering_port : 0),
|
||||
telemetry{ nano::telemetry::config{ config, flags }, *this, network, observers, network_params, stats },
|
||||
telemetry_impl{ std::make_unique<nano::telemetry> (flags, *this, network, observers, network_params, stats) },
|
||||
telemetry{ *telemetry_impl },
|
||||
bootstrap_initiator (*this),
|
||||
bootstrap_server{ config.bootstrap_server, store, ledger, network_params.network, stats },
|
||||
// BEWARE: `bootstrap` takes `network.port` instead of `config.peering_port` because when the user doesn't specify
|
||||
|
|
@ -218,7 +142,8 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy
|
|||
aggregator_impl{ std::make_unique<nano::request_aggregator> (config.request_aggregator, *this, stats, generator, final_generator, history, ledger, wallets, vote_router) },
|
||||
aggregator{ *aggregator_impl },
|
||||
wallets (wallets_store.init_error (), *this),
|
||||
backlog{ nano::backlog_population_config (config), scheduler, ledger, stats },
|
||||
backlog_impl{ std::make_unique<nano::backlog_population> (config.backlog_population, scheduler, ledger, stats) },
|
||||
backlog{ *backlog_impl },
|
||||
ascendboot_impl{ std::make_unique<nano::bootstrap_ascending::service> (config, block_processor, ledger, network, stats, logger) },
|
||||
ascendboot{ *ascendboot_impl },
|
||||
websocket{ config.websocket_config, observers, wallets, ledger, io_ctx, logger },
|
||||
|
|
@ -572,6 +497,34 @@ bool nano::node::copy_with_compaction (std::filesystem::path const & destination
|
|||
return store.copy_db (destination);
|
||||
}
|
||||
|
||||
void nano::node::keepalive (std::string const & address_a, uint16_t port_a)
|
||||
{
|
||||
auto node_l (shared_from_this ());
|
||||
network.resolver.async_resolve (boost::asio::ip::tcp::resolver::query (address_a, std::to_string (port_a)), [node_l, address_a, port_a] (boost::system::error_code const & ec, boost::asio::ip::tcp::resolver::iterator i_a) {
|
||||
if (!ec)
|
||||
{
|
||||
for (auto i (i_a), n (boost::asio::ip::tcp::resolver::iterator{}); i != n; ++i)
|
||||
{
|
||||
auto endpoint (nano::transport::map_endpoint_to_v6 (i->endpoint ()));
|
||||
std::weak_ptr<nano::node> node_w (node_l);
|
||||
auto channel (node_l->network.find_channel (endpoint));
|
||||
if (!channel)
|
||||
{
|
||||
node_l->network.tcp_channels.start_tcp (endpoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
node_l->network.send_keepalive (channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node_l->logger.error (nano::log::type::node, "Error resolving address for keepalive: {}:{} ({})", address_a, port_a, ec.message ());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
std::unique_ptr<nano::container_info_component> nano::collect_container_info (node & node, std::string const & name)
|
||||
{
|
||||
auto composite = std::make_unique<container_info_composite> (name);
|
||||
|
|
@ -1374,3 +1327,32 @@ std::string nano::node::make_logger_identifier (const nano::keypair & node_id)
|
|||
// Node identifier consists of first 10 characters of node id
|
||||
return node_id.pub.to_node_id ().substr (0, 10);
|
||||
}
|
||||
|
||||
nano::keypair nano::load_or_create_node_id (std::filesystem::path const & application_path)
|
||||
{
|
||||
auto node_private_key_path = application_path / "node_id_private.key";
|
||||
std::ifstream ifs (node_private_key_path.c_str ());
|
||||
if (ifs.good ())
|
||||
{
|
||||
nano::default_logger ().info (nano::log::type::init, "Reading node id from: '{}'", node_private_key_path.string ());
|
||||
|
||||
std::string node_private_key;
|
||||
ifs >> node_private_key;
|
||||
release_assert (node_private_key.size () == 64);
|
||||
nano::keypair kp = nano::keypair (node_private_key);
|
||||
return kp;
|
||||
}
|
||||
else
|
||||
{
|
||||
// no node_id found, generate new one
|
||||
nano::default_logger ().info (nano::log::type::init, "Generating a new node id, saving to: '{}'", node_private_key_path.string ());
|
||||
|
||||
nano::keypair kp;
|
||||
std::ofstream ofs (node_private_key_path.c_str (), std::ofstream::out | std::ofstream::trunc);
|
||||
ofs << kp.prv.to_string () << std::endl
|
||||
<< std::flush;
|
||||
ofs.close ();
|
||||
release_assert (!ofs.fail ());
|
||||
return kp;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,8 +6,6 @@
|
|||
#include <nano/lib/stats.hpp>
|
||||
#include <nano/lib/thread_pool.hpp>
|
||||
#include <nano/lib/work.hpp>
|
||||
#include <nano/node/backlog_population.hpp>
|
||||
#include <nano/node/bandwidth_limiter.hpp>
|
||||
#include <nano/node/blockprocessor.hpp>
|
||||
#include <nano/node/bootstrap/bootstrap.hpp>
|
||||
#include <nano/node/bootstrap/bootstrap_attempt.hpp>
|
||||
|
|
@ -22,7 +20,6 @@
|
|||
#include <nano/node/process_live_dispatcher.hpp>
|
||||
#include <nano/node/rep_tiers.hpp>
|
||||
#include <nano/node/repcrawler.hpp>
|
||||
#include <nano/node/telemetry.hpp>
|
||||
#include <nano/node/transport/tcp_server.hpp>
|
||||
#include <nano/node/unchecked_map.hpp>
|
||||
#include <nano/node/vote_cache.hpp>
|
||||
|
|
@ -41,10 +38,13 @@
|
|||
namespace nano
|
||||
{
|
||||
class active_elections;
|
||||
class backlog_population;
|
||||
class bandwidth_limiter;
|
||||
class confirming_set;
|
||||
class message_processor;
|
||||
class monitor;
|
||||
class node;
|
||||
class telemetry;
|
||||
class vote_processor;
|
||||
class vote_cache_processor;
|
||||
class vote_router;
|
||||
|
|
@ -72,10 +72,6 @@ namespace rocksdb
|
|||
|
||||
namespace nano
|
||||
{
|
||||
// Configs
|
||||
backlog_population::config backlog_population_config (node_config const &);
|
||||
outbound_bandwidth_limiter::config outbound_bandwidth_limiter_config (node_config const &);
|
||||
|
||||
class node final : public std::enable_shared_from_this<node>
|
||||
{
|
||||
public:
|
||||
|
|
@ -84,16 +80,19 @@ public:
|
|||
~node ();
|
||||
|
||||
public:
|
||||
void start ();
|
||||
void stop ();
|
||||
|
||||
std::shared_ptr<nano::node> shared ();
|
||||
|
||||
template <typename T>
|
||||
void background (T action_a)
|
||||
{
|
||||
io_ctx.post (action_a);
|
||||
}
|
||||
|
||||
bool copy_with_compaction (std::filesystem::path const &);
|
||||
void keepalive (std::string const &, uint16_t);
|
||||
void start ();
|
||||
void stop ();
|
||||
std::shared_ptr<nano::node> shared ();
|
||||
int store_version ();
|
||||
void process_confirmed (nano::election_status const &, uint64_t = 0);
|
||||
void process_active (std::shared_ptr<nano::block> const &);
|
||||
|
|
@ -170,11 +169,13 @@ public:
|
|||
nano::wallets_store & wallets_store;
|
||||
std::unique_ptr<nano::ledger> ledger_impl;
|
||||
nano::ledger & ledger;
|
||||
nano::outbound_bandwidth_limiter outbound_limiter;
|
||||
std::unique_ptr<nano::bandwidth_limiter> outbound_limiter_impl;
|
||||
nano::bandwidth_limiter & outbound_limiter;
|
||||
std::unique_ptr<nano::message_processor> message_processor_impl;
|
||||
nano::message_processor & message_processor;
|
||||
nano::network network;
|
||||
nano::telemetry telemetry;
|
||||
std::unique_ptr<nano::telemetry> telemetry_impl;
|
||||
nano::telemetry & telemetry;
|
||||
nano::bootstrap_initiator bootstrap_initiator;
|
||||
nano::bootstrap_server bootstrap_server;
|
||||
std::unique_ptr<nano::transport::tcp_listener> tcp_listener_impl;
|
||||
|
|
@ -212,7 +213,8 @@ public:
|
|||
std::unique_ptr<nano::request_aggregator> aggregator_impl;
|
||||
nano::request_aggregator & aggregator;
|
||||
nano::wallets wallets;
|
||||
nano::backlog_population backlog;
|
||||
std::unique_ptr<nano::backlog_population> backlog_impl;
|
||||
nano::backlog_population & backlog;
|
||||
std::unique_ptr<nano::bootstrap_ascending::service> ascendboot_impl;
|
||||
nano::bootstrap_ascending::service & ascendboot;
|
||||
nano::websocket_server websocket;
|
||||
|
|
|
|||
|
|
@ -138,13 +138,10 @@ nano::error nano::node_config::serialize_toml (nano::tomlconfig & toml) const
|
|||
toml.put ("confirming_set_batch_time", confirming_set_batch_time.count (), "Maximum time the confirming set will hold the database write transaction.\ntype:milliseconds");
|
||||
toml.put ("backup_before_upgrade", backup_before_upgrade, "Backup the ledger database before performing upgrades.\nWarning: uses more disk storage and increases startup time when upgrading.\ntype:bool");
|
||||
toml.put ("max_work_generate_multiplier", max_work_generate_multiplier, "Maximum allowed difficulty multiplier for work generation.\ntype:double,[1..]");
|
||||
toml.put ("frontiers_confirmation", serialize_frontiers_confirmation (frontiers_confirmation), "Mode controlling frontier confirmation rate.\ntype:string,{auto,always,disabled}");
|
||||
toml.put ("max_queued_requests", max_queued_requests, "Limit for number of queued confirmation requests for one channel, after which new requests are dropped until the queue drops below this value.\ntype:uint32");
|
||||
toml.put ("request_aggregator_threads", request_aggregator_threads, "Number of threads to dedicate to request aggregator. Defaults to using all cpu threads, up to a maximum of 4");
|
||||
toml.put ("max_unchecked_blocks", max_unchecked_blocks, "Maximum number of unchecked blocks to store in memory. Defaults to 65536. \ntype:uint64,[0..]");
|
||||
toml.put ("rep_crawler_weight_minimum", rep_crawler_weight_minimum.to_string_dec (), "Rep crawler minimum weight, if this is less than minimum principal weight then this is taken as the minimum weight a rep must have to be tracked. If you want to track all reps set this to 0. If you do not want this to influence anything then set it to max value. This is only useful for debugging or for people who really know what they are doing.\ntype:string,amount,raw");
|
||||
toml.put ("backlog_scan_batch_size", backlog_scan_batch_size, "Number of accounts per second to process when doing backlog population scan. Increasing this value will help unconfirmed frontiers get into election prioritization queue faster, however it will also increase resource usage. \ntype:uint");
|
||||
toml.put ("backlog_scan_frequency", backlog_scan_frequency, "Backlog scan divides the scan into smaller batches, number of which is controlled by this value. Higher frequency helps to utilize resources more uniformly, however it also introduces more overhead. The resulting number of accounts per single batch is `backlog_scan_batch_size / backlog_scan_frequency` \ntype:uint");
|
||||
toml.put ("enable_upnp", enable_upnp, "Enable or disable automatic UPnP port forwarding. This feature only works if the node is directly connected to a router (not inside a docker container, etc.).\ntype:bool");
|
||||
|
||||
auto work_peers_l (toml.create_array ("work_peers", "A list of \"address:port\" entries to identify work peers."));
|
||||
|
|
@ -182,6 +179,10 @@ nano::error nano::node_config::serialize_toml (nano::tomlconfig & toml) const
|
|||
callback_l.put ("target", callback_target, "Callback target path.\ntype:string,uri");
|
||||
toml.put_child ("httpcallback", callback_l);
|
||||
|
||||
/*
|
||||
* Subconfigs
|
||||
*/
|
||||
|
||||
nano::tomlconfig websocket_l;
|
||||
websocket_config.serialize_toml (websocket_l);
|
||||
toml.put_child ("websocket", websocket_l);
|
||||
|
|
@ -258,6 +259,10 @@ nano::error nano::node_config::serialize_toml (nano::tomlconfig & toml) const
|
|||
monitor.serialize (monitor_l);
|
||||
toml.put_child ("monitor", monitor_l);
|
||||
|
||||
nano::tomlconfig backlog_population_l;
|
||||
backlog_population.serialize (backlog_population_l);
|
||||
toml.put_child ("backlog_population", backlog_population_l);
|
||||
|
||||
return toml.get_error ();
|
||||
}
|
||||
|
||||
|
|
@ -273,6 +278,10 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml)
|
|||
callback_l.get<std::string> ("target", callback_target);
|
||||
}
|
||||
|
||||
/*
|
||||
* Subconfigs
|
||||
*/
|
||||
|
||||
if (toml.has_key ("websocket"))
|
||||
{
|
||||
auto websocket_config_l (toml.get_required_child ("websocket"));
|
||||
|
|
@ -387,6 +396,16 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml)
|
|||
monitor.deserialize (config_l);
|
||||
}
|
||||
|
||||
if (toml.has_key ("backlog_population"))
|
||||
{
|
||||
auto config_l = toml.get_required_child ("backlog_population");
|
||||
backlog_population.deserialize (config_l);
|
||||
}
|
||||
|
||||
/*
|
||||
* Values
|
||||
*/
|
||||
|
||||
if (toml.has_key ("work_peers"))
|
||||
{
|
||||
work_peers.clear ();
|
||||
|
|
@ -547,15 +566,6 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml)
|
|||
toml.get_error ().set ("rep_crawler_weight_minimum contains an invalid decimal amount");
|
||||
}
|
||||
|
||||
if (toml.has_key ("frontiers_confirmation"))
|
||||
{
|
||||
auto frontiers_confirmation_l (toml.get<std::string> ("frontiers_confirmation"));
|
||||
frontiers_confirmation = deserialize_frontiers_confirmation (frontiers_confirmation_l);
|
||||
}
|
||||
|
||||
toml.get<unsigned> ("backlog_scan_batch_size", backlog_scan_batch_size);
|
||||
toml.get<unsigned> ("backlog_scan_frequency", backlog_scan_frequency);
|
||||
|
||||
toml.get<bool> ("enable_upnp", enable_upnp);
|
||||
|
||||
if (toml.has_key ("experimental"))
|
||||
|
|
@ -598,10 +608,6 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml)
|
|||
{
|
||||
toml.get_error ().set ("max_work_generate_multiplier must be greater than or equal to 1");
|
||||
}
|
||||
if (frontiers_confirmation == nano::frontiers_confirmation_mode::invalid)
|
||||
{
|
||||
toml.get_error ().set ("frontiers_confirmation value is invalid (available: always, auto, disabled)");
|
||||
}
|
||||
if (block_processor_batch_max_time < network_params.node.process_confirmed_interval)
|
||||
{
|
||||
toml.get_error ().set ((boost::format ("block_processor_batch_max_time value must be equal or larger than %1%ms") % network_params.node.process_confirmed_interval.count ()).str ());
|
||||
|
|
@ -623,41 +629,6 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml)
|
|||
return toml.get_error ();
|
||||
}
|
||||
|
||||
std::string nano::node_config::serialize_frontiers_confirmation (nano::frontiers_confirmation_mode mode_a) const
|
||||
{
|
||||
switch (mode_a)
|
||||
{
|
||||
case nano::frontiers_confirmation_mode::always:
|
||||
return "always";
|
||||
case nano::frontiers_confirmation_mode::automatic:
|
||||
return "auto";
|
||||
case nano::frontiers_confirmation_mode::disabled:
|
||||
return "disabled";
|
||||
default:
|
||||
return "auto";
|
||||
}
|
||||
}
|
||||
|
||||
nano::frontiers_confirmation_mode nano::node_config::deserialize_frontiers_confirmation (std::string const & string_a)
|
||||
{
|
||||
if (string_a == "always")
|
||||
{
|
||||
return nano::frontiers_confirmation_mode::always;
|
||||
}
|
||||
else if (string_a == "auto")
|
||||
{
|
||||
return nano::frontiers_confirmation_mode::automatic;
|
||||
}
|
||||
else if (string_a == "disabled")
|
||||
{
|
||||
return nano::frontiers_confirmation_mode::disabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
return nano::frontiers_confirmation_mode::invalid;
|
||||
}
|
||||
}
|
||||
|
||||
void nano::node_config::deserialize_address (std::string const & entry_a, std::vector<std::pair<std::string, uint16_t>> & container_a) const
|
||||
{
|
||||
auto port_position (entry_a.rfind (':'));
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <nano/lib/rocksdbconfig.hpp>
|
||||
#include <nano/lib/stats.hpp>
|
||||
#include <nano/node/active_elections.hpp>
|
||||
#include <nano/node/backlog_population.hpp>
|
||||
#include <nano/node/blockprocessor.hpp>
|
||||
#include <nano/node/bootstrap/bootstrap_config.hpp>
|
||||
#include <nano/node/bootstrap/bootstrap_server.hpp>
|
||||
|
|
@ -40,16 +41,6 @@ namespace nano
|
|||
{
|
||||
class tomlconfig;
|
||||
|
||||
enum class frontiers_confirmation_mode : uint8_t
|
||||
{
|
||||
always, // Always confirm frontiers
|
||||
automatic, // Always mode if node contains representative with at least 50% of principal weight, less frequest requests if not
|
||||
disabled, // Do not confirm frontiers
|
||||
invalid
|
||||
};
|
||||
|
||||
class message_processor_config;
|
||||
|
||||
/**
|
||||
* Node configuration
|
||||
*/
|
||||
|
|
@ -142,11 +133,6 @@ public:
|
|||
uint64_t max_pruning_depth{ 0 };
|
||||
nano::rocksdb_config rocksdb_config;
|
||||
nano::lmdb_config lmdb_config;
|
||||
nano::frontiers_confirmation_mode frontiers_confirmation{ nano::frontiers_confirmation_mode::automatic };
|
||||
/** Number of accounts per second to process when doing backlog population scan */
|
||||
unsigned backlog_scan_batch_size{ 10 * 1000 };
|
||||
/** Number of times per second to run backlog population batches. Number of accounts per single batch is `backlog_scan_batch_size / backlog_scan_frequency` */
|
||||
unsigned backlog_scan_frequency{ 10 };
|
||||
bool enable_upnp{ true };
|
||||
nano::vote_cache_config vote_cache;
|
||||
nano::rep_crawler_config rep_crawler;
|
||||
|
|
@ -161,10 +147,9 @@ public:
|
|||
nano::local_block_broadcaster_config local_block_broadcaster;
|
||||
nano::confirming_set_config confirming_set;
|
||||
nano::monitor_config monitor;
|
||||
nano::backlog_population_config backlog_population;
|
||||
|
||||
public:
|
||||
std::string serialize_frontiers_confirmation (nano::frontiers_confirmation_mode) const;
|
||||
nano::frontiers_confirmation_mode deserialize_frontiers_confirmation (std::string const &);
|
||||
/** Entry is ignored if it cannot be parsed as a valid address:port */
|
||||
void deserialize_address (std::string const &, std::vector<std::pair<std::string, uint16_t>> &) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
nano::telemetry::telemetry (const config & config_a, nano::node & node_a, nano::network & network_a, nano::node_observers & observers_a, nano::network_params & network_params_a, nano::stats & stats_a) :
|
||||
config_m{ config_a },
|
||||
nano::telemetry::telemetry (nano::node_flags const & flags_a, nano::node & node_a, nano::network & network_a, nano::node_observers & observers_a, nano::network_params & network_params_a, nano::stats & stats_a) :
|
||||
config{ flags_a },
|
||||
node{ node_a },
|
||||
network{ network_a },
|
||||
observers{ observers_a },
|
||||
|
|
@ -150,7 +150,7 @@ bool nano::telemetry::request_predicate () const
|
|||
{
|
||||
return true;
|
||||
}
|
||||
if (config_m.enable_ongoing_requests)
|
||||
if (config.enable_ongoing_requests)
|
||||
{
|
||||
return last_request + network_params.network.telemetry_request_interval < std::chrono::steady_clock::now ();
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ bool nano::telemetry::broadcast_predicate () const
|
|||
{
|
||||
debug_assert (!mutex.try_lock ());
|
||||
|
||||
if (config_m.enable_ongoing_broadcasts)
|
||||
if (config.enable_ongoing_broadcasts)
|
||||
{
|
||||
return last_broadcast + network_params.network.telemetry_broadcast_interval < std::chrono::steady_clock::now ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,19 @@ namespace transport
|
|||
class channel;
|
||||
}
|
||||
|
||||
class telemetry_config final
|
||||
{
|
||||
public:
|
||||
bool enable_ongoing_requests{ false }; // TODO: No longer used, remove
|
||||
bool enable_ongoing_broadcasts{ true };
|
||||
|
||||
public:
|
||||
explicit telemetry_config (nano::node_flags const & flags) :
|
||||
enable_ongoing_broadcasts{ !flags.disable_providing_telemetry_metrics }
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* This class periodically broadcasts and requests telemetry from peers.
|
||||
* Those intervals are configurable via `telemetry_request_interval` & `telemetry_broadcast_interval` network constants
|
||||
|
|
@ -43,19 +56,7 @@ namespace transport
|
|||
class telemetry
|
||||
{
|
||||
public:
|
||||
struct config
|
||||
{
|
||||
bool enable_ongoing_requests{ false };
|
||||
bool enable_ongoing_broadcasts{ true };
|
||||
|
||||
config (nano::node_config const & config, nano::node_flags const & flags) :
|
||||
enable_ongoing_broadcasts{ !flags.disable_providing_telemetry_metrics }
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
telemetry (config const &, nano::node &, nano::network &, nano::node_observers &, nano::network_params &, nano::stats &);
|
||||
telemetry (nano::node_flags const &, nano::node &, nano::network &, nano::node_observers &, nano::network_params &, nano::stats &);
|
||||
~telemetry ();
|
||||
|
||||
void start ();
|
||||
|
|
@ -87,14 +88,13 @@ public: // Container info
|
|||
std::unique_ptr<nano::container_info_component> collect_container_info (std::string const & name);
|
||||
|
||||
private: // Dependencies
|
||||
telemetry_config const config;
|
||||
nano::node & node;
|
||||
nano::network & network;
|
||||
nano::node_observers & observers;
|
||||
nano::network_params & network_params;
|
||||
nano::stats & stats;
|
||||
|
||||
const config config_m;
|
||||
|
||||
private:
|
||||
struct entry
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ void nano::transport::channel::send (nano::message & message_a, std::function<vo
|
|||
auto buffer = message_a.to_shared_const_buffer ();
|
||||
|
||||
bool is_droppable_by_limiter = (drop_policy_a == nano::transport::buffer_drop_policy::limiter);
|
||||
bool should_pass = node.outbound_limiter.should_pass (buffer.size (), to_bandwidth_limit_type (traffic_type));
|
||||
bool should_pass = node.outbound_limiter.should_pass (buffer.size (), traffic_type);
|
||||
bool pass = !is_droppable_by_limiter || should_pass;
|
||||
|
||||
node.stats.inc (pass ? nano::stat::type::message : nano::stat::type::drop, to_stat_detail (message_a.type ()), nano::stat::dir::out, /* aggregate all */ true);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ namespace nano::transport
|
|||
enum class traffic_type
|
||||
{
|
||||
generic,
|
||||
/** For bootstrap (asc_pull_ack, asc_pull_req) traffic */
|
||||
bootstrap
|
||||
bootstrap, // Ascending bootstrap (asc_pull_ack, asc_pull_req) traffic
|
||||
};
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ TEST (rpc, receivable_unconfirmed)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto node = add_ipc_enabled_node (system, config);
|
||||
auto chain = nano::test::setup_chain (system, *node, 1, nano::dev::genesis_key, false);
|
||||
auto block1 = chain[0];
|
||||
|
|
@ -530,7 +530,7 @@ TEST (rpc, accounts_receivable_confirmed)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto node = add_ipc_enabled_node (system, config);
|
||||
auto chain = nano::test::setup_chain (system, *node, 1, nano::dev::genesis_key, false);
|
||||
auto block1 = chain[0];
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <nano/node/scheduler/component.hpp>
|
||||
#include <nano/node/scheduler/manual.hpp>
|
||||
#include <nano/node/scheduler/priority.hpp>
|
||||
#include <nano/node/telemetry.hpp>
|
||||
#include <nano/rpc/rpc.hpp>
|
||||
#include <nano/rpc/rpc_request_processor.hpp>
|
||||
#include <nano/rpc_test/common.hpp>
|
||||
|
|
@ -3031,7 +3032,7 @@ TEST (rpc, accounts_balances_unopened_account_with_receivables)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto node = add_ipc_enabled_node (system, config);
|
||||
|
||||
// send a 1 raw to the unopened account which will have receivables
|
||||
|
|
@ -3335,7 +3336,7 @@ TEST (rpc, pending_exists)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto node = add_ipc_enabled_node (system, config);
|
||||
nano::keypair key1;
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
|
@ -3394,7 +3395,7 @@ TEST (rpc, wallet_receivable)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config config;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto node = add_ipc_enabled_node (system, config);
|
||||
nano::keypair key1;
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
|
@ -4458,7 +4459,7 @@ TEST (rpc, populate_backlog)
|
|||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
// Disable automatic backlog population
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = add_ipc_enabled_node (system, node_config);
|
||||
|
||||
// Create and process a block that won't get automatically scheduled for confirmation
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <nano/node/scheduler/component.hpp>
|
||||
#include <nano/node/scheduler/manual.hpp>
|
||||
#include <nano/node/scheduler/priority.hpp>
|
||||
#include <nano/node/telemetry.hpp>
|
||||
#include <nano/node/transport/inproc.hpp>
|
||||
#include <nano/node/unchecked_map.hpp>
|
||||
#include <nano/secure/ledger.hpp>
|
||||
|
|
@ -640,7 +641,7 @@ TEST (confirmation_height, many_accounts_single_confirmation)
|
|||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.online_weight_minimum = 100;
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config);
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
||||
|
|
@ -724,7 +725,7 @@ TEST (confirmation_height, many_accounts_many_confirmations)
|
|||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.online_weight_minimum = 100;
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config);
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
||||
|
|
@ -799,7 +800,7 @@ TEST (confirmation_height, long_chains)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config);
|
||||
nano::keypair key1;
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
|
@ -945,7 +946,7 @@ TEST (confirmation_height, dynamic_algorithm)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config);
|
||||
nano::keypair key;
|
||||
system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv);
|
||||
|
|
@ -994,7 +995,7 @@ TEST (confirmation_height, many_accounts_send_receive_self)
|
|||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.online_weight_minimum = 100;
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
node_config.active_elections.size = 400000;
|
||||
nano::node_flags node_flags;
|
||||
auto node = system.add_node (node_config);
|
||||
|
|
@ -1413,7 +1414,7 @@ TEST (telemetry, under_load)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
nano::node_flags node_flags;
|
||||
auto node = system.add_node (node_config, node_flags);
|
||||
node_config.peering_port = system.get_available_port ();
|
||||
|
|
@ -1774,7 +1775,7 @@ TEST (node, mass_block_new)
|
|||
{
|
||||
nano::test::system system;
|
||||
nano::node_config node_config = system.default_config ();
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (node_config);
|
||||
node.network_params.network.aec_loop_interval_ms = 500;
|
||||
|
||||
|
|
@ -2036,7 +2037,7 @@ TEST (node, wallet_create_block_confirm_conflicts)
|
|||
nano::test::system system;
|
||||
nano::block_builder builder;
|
||||
nano::node_config node_config (system.get_available_port ());
|
||||
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
node_config.backlog_population.enable = false;
|
||||
auto node = system.add_node (node_config);
|
||||
auto const num_blocks = 10000;
|
||||
|
||||
|
|
@ -2107,7 +2108,7 @@ TEST (system, block_sequence)
|
|||
config.peering_port = system.get_available_port ();
|
||||
// config.bandwidth_limit = 16 * 1024;
|
||||
config.enable_voting = true;
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
nano::node_flags flags;
|
||||
flags.disable_max_peers_per_ip = true;
|
||||
flags.disable_ongoing_bootstrap = true;
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ TEST (vote_cache, perf_singlethreaded)
|
|||
nano::test::system system;
|
||||
nano::node_flags flags;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (config, flags);
|
||||
|
||||
const int rep_count = 50;
|
||||
|
|
@ -193,7 +193,7 @@ TEST (vote_cache, perf_multithreaded)
|
|||
nano::test::system system;
|
||||
nano::node_flags flags;
|
||||
nano::node_config config = system.default_config ();
|
||||
config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
|
||||
config.backlog_population.enable = false;
|
||||
auto & node = *system.add_node (config, flags);
|
||||
|
||||
const int thread_count = 12;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue