diff --git a/nano/core_test/active_elections.cpp b/nano/core_test/active_elections.cpp index 0b535268d..2b216f5ae 100644 --- a/nano/core_test/active_elections.cpp +++ b/nano/core_test/active_elections.cpp @@ -1442,10 +1442,10 @@ TEST (active_elections, broadcast_block_on_activation) nano::node_config config1 = system.default_config (); // Deactivates elections on both nodes. config1.active_elections.size = 0; - config1.bootstrap_ascending.enable = false; + config1.bootstrap.enable = false; nano::node_config config2 = system.default_config (); config2.active_elections.size = 0; - config2.bootstrap_ascending.enable = false; + config2.bootstrap.enable = false; nano::node_flags flags; // Disables bootstrap listener to make sure the block won't be shared by this channel. flags.disable_bootstrap_listener = true; diff --git a/nano/core_test/bootstrap_ascending.cpp b/nano/core_test/bootstrap_ascending.cpp index c46004df9..45f0d6c4e 100644 --- a/nano/core_test/bootstrap_ascending.cpp +++ b/nano/core_test/bootstrap_ascending.cpp @@ -280,8 +280,8 @@ TEST (bootstrap, frontier_scan) flags.disable_legacy_bootstrap = true; nano::node_config config; // Disable other bootstrap strategies - config.bootstrap_ascending.enable_scan = false; - config.bootstrap_ascending.enable_dependency_walker = false; + config.bootstrap.enable_scan = false; + config.bootstrap.enable_dependency_walker = false; // Disable election activation config.backlog_population.enable = false; config.priority_scheduler.enable = false; @@ -376,8 +376,8 @@ TEST (bootstrap, frontier_scan_pending) flags.disable_legacy_bootstrap = true; nano::node_config config; // Disable other bootstrap strategies - config.bootstrap_ascending.enable_scan = false; - config.bootstrap_ascending.enable_dependency_walker = false; + config.bootstrap.enable_scan = false; + config.bootstrap.enable_dependency_walker = false; // Disable election activation config.backlog_population.enable = false; config.priority_scheduler.enable = false; @@ -458,8 +458,8 @@ TEST (bootstrap, frontier_scan_cannot_prioritize) flags.disable_legacy_bootstrap = true; nano::node_config config; // Disable other bootstrap strategies - config.bootstrap_ascending.enable_scan = false; - config.bootstrap_ascending.enable_dependency_walker = false; + config.bootstrap.enable_scan = false; + config.bootstrap.enable_dependency_walker = false; // Disable election activation config.backlog_population.enable = false; config.priority_scheduler.enable = false; diff --git a/nano/core_test/toml.cpp b/nano/core_test/toml.cpp index 6c294ad94..0da8a59f7 100644 --- a/nano/core_test/toml.cpp +++ b/nano/core_test/toml.cpp @@ -117,7 +117,7 @@ TEST (toml, daemon_config_deserialize_defaults) ss << R"toml( [node] [node.backlog_population] - [node.bootstrap_ascending] + [node.bootstrap] [node.bootstrap_server] [node.block_processor] [node.diagnostics.txn_tracking] @@ -269,18 +269,18 @@ TEST (toml, daemon_config_deserialize_defaults) ASSERT_EQ (conf.node.vote_processor.threads, defaults.node.vote_processor.threads); ASSERT_EQ (conf.node.vote_processor.batch_size, defaults.node.vote_processor.batch_size); - ASSERT_EQ (conf.node.bootstrap_ascending.enable, defaults.node.bootstrap_ascending.enable); - ASSERT_EQ (conf.node.bootstrap_ascending.enable_database_scan, defaults.node.bootstrap_ascending.enable_database_scan); - ASSERT_EQ (conf.node.bootstrap_ascending.enable_dependency_walker, defaults.node.bootstrap_ascending.enable_dependency_walker); - ASSERT_EQ (conf.node.bootstrap_ascending.channel_limit, defaults.node.bootstrap_ascending.channel_limit); - ASSERT_EQ (conf.node.bootstrap_ascending.database_rate_limit, defaults.node.bootstrap_ascending.database_rate_limit); - ASSERT_EQ (conf.node.bootstrap_ascending.database_warmup_ratio, defaults.node.bootstrap_ascending.database_warmup_ratio); - ASSERT_EQ (conf.node.bootstrap_ascending.max_pull_count, defaults.node.bootstrap_ascending.max_pull_count); - ASSERT_EQ (conf.node.bootstrap_ascending.request_timeout, defaults.node.bootstrap_ascending.request_timeout); - ASSERT_EQ (conf.node.bootstrap_ascending.throttle_coefficient, defaults.node.bootstrap_ascending.throttle_coefficient); - ASSERT_EQ (conf.node.bootstrap_ascending.throttle_wait, defaults.node.bootstrap_ascending.throttle_wait); - ASSERT_EQ (conf.node.bootstrap_ascending.block_processor_threshold, defaults.node.bootstrap_ascending.block_processor_threshold); - ASSERT_EQ (conf.node.bootstrap_ascending.max_requests, defaults.node.bootstrap_ascending.max_requests); + ASSERT_EQ (conf.node.bootstrap.enable, defaults.node.bootstrap.enable); + ASSERT_EQ (conf.node.bootstrap.enable_database_scan, defaults.node.bootstrap.enable_database_scan); + ASSERT_EQ (conf.node.bootstrap.enable_dependency_walker, defaults.node.bootstrap.enable_dependency_walker); + ASSERT_EQ (conf.node.bootstrap.channel_limit, defaults.node.bootstrap.channel_limit); + ASSERT_EQ (conf.node.bootstrap.database_rate_limit, defaults.node.bootstrap.database_rate_limit); + ASSERT_EQ (conf.node.bootstrap.database_warmup_ratio, defaults.node.bootstrap.database_warmup_ratio); + ASSERT_EQ (conf.node.bootstrap.max_pull_count, defaults.node.bootstrap.max_pull_count); + ASSERT_EQ (conf.node.bootstrap.request_timeout, defaults.node.bootstrap.request_timeout); + ASSERT_EQ (conf.node.bootstrap.throttle_coefficient, defaults.node.bootstrap.throttle_coefficient); + ASSERT_EQ (conf.node.bootstrap.throttle_wait, defaults.node.bootstrap.throttle_wait); + ASSERT_EQ (conf.node.bootstrap.block_processor_threshold, defaults.node.bootstrap.block_processor_threshold); + ASSERT_EQ (conf.node.bootstrap.max_requests, defaults.node.bootstrap.max_requests); ASSERT_EQ (conf.node.bootstrap_server.max_queue, defaults.node.bootstrap_server.max_queue); ASSERT_EQ (conf.node.bootstrap_server.threads, defaults.node.bootstrap_server.threads); @@ -597,7 +597,7 @@ TEST (toml, daemon_config_deserialize_no_defaults) threads = 999 batch_size = 999 - [node.bootstrap_ascending] + [node.bootstrap] enable = false enable_frontier_scan = false enable_database_scan = true @@ -777,19 +777,19 @@ TEST (toml, daemon_config_deserialize_no_defaults) ASSERT_NE (conf.node.vote_processor.threads, defaults.node.vote_processor.threads); ASSERT_NE (conf.node.vote_processor.batch_size, defaults.node.vote_processor.batch_size); - ASSERT_NE (conf.node.bootstrap_ascending.enable, defaults.node.bootstrap_ascending.enable); - ASSERT_NE (conf.node.bootstrap_ascending.enable_frontier_scan, defaults.node.bootstrap_ascending.enable_frontier_scan); - ASSERT_NE (conf.node.bootstrap_ascending.enable_database_scan, defaults.node.bootstrap_ascending.enable_database_scan); - ASSERT_NE (conf.node.bootstrap_ascending.enable_dependency_walker, defaults.node.bootstrap_ascending.enable_dependency_walker); - ASSERT_NE (conf.node.bootstrap_ascending.channel_limit, defaults.node.bootstrap_ascending.channel_limit); - ASSERT_NE (conf.node.bootstrap_ascending.database_rate_limit, defaults.node.bootstrap_ascending.database_rate_limit); - ASSERT_NE (conf.node.bootstrap_ascending.database_warmup_ratio, defaults.node.bootstrap_ascending.database_warmup_ratio); - ASSERT_NE (conf.node.bootstrap_ascending.max_pull_count, defaults.node.bootstrap_ascending.max_pull_count); - ASSERT_NE (conf.node.bootstrap_ascending.request_timeout, defaults.node.bootstrap_ascending.request_timeout); - ASSERT_NE (conf.node.bootstrap_ascending.throttle_coefficient, defaults.node.bootstrap_ascending.throttle_coefficient); - ASSERT_NE (conf.node.bootstrap_ascending.throttle_wait, defaults.node.bootstrap_ascending.throttle_wait); - ASSERT_NE (conf.node.bootstrap_ascending.block_processor_threshold, defaults.node.bootstrap_ascending.block_processor_threshold); - ASSERT_NE (conf.node.bootstrap_ascending.max_requests, defaults.node.bootstrap_ascending.max_requests); + ASSERT_NE (conf.node.bootstrap.enable, defaults.node.bootstrap.enable); + ASSERT_NE (conf.node.bootstrap.enable_database_scan, defaults.node.bootstrap.enable_database_scan); + ASSERT_NE (conf.node.bootstrap.enable_frontier_scan, defaults.node.bootstrap.enable_frontier_scan); + ASSERT_NE (conf.node.bootstrap.enable_dependency_walker, defaults.node.bootstrap.enable_dependency_walker); + ASSERT_NE (conf.node.bootstrap.channel_limit, defaults.node.bootstrap.channel_limit); + ASSERT_NE (conf.node.bootstrap.database_rate_limit, defaults.node.bootstrap.database_rate_limit); + ASSERT_NE (conf.node.bootstrap.database_warmup_ratio, defaults.node.bootstrap.database_warmup_ratio); + ASSERT_NE (conf.node.bootstrap.max_pull_count, defaults.node.bootstrap.max_pull_count); + ASSERT_NE (conf.node.bootstrap.request_timeout, defaults.node.bootstrap.request_timeout); + ASSERT_NE (conf.node.bootstrap.throttle_coefficient, defaults.node.bootstrap.throttle_coefficient); + ASSERT_NE (conf.node.bootstrap.throttle_wait, defaults.node.bootstrap.throttle_wait); + ASSERT_NE (conf.node.bootstrap.block_processor_threshold, defaults.node.bootstrap.block_processor_threshold); + ASSERT_NE (conf.node.bootstrap.max_requests, defaults.node.bootstrap.max_requests); ASSERT_NE (conf.node.bootstrap_server.max_queue, defaults.node.bootstrap_server.max_queue); ASSERT_NE (conf.node.bootstrap_server.threads, defaults.node.bootstrap_server.threads); @@ -1081,7 +1081,7 @@ TEST (toml, merge_config_files) [node] active_elections.size = 999 # background_threads = 7777 - [node.bootstrap_ascending] + [node.bootstrap] block_processor_threshold = 33333 old_entry = 34 )toml"; @@ -1105,6 +1105,6 @@ 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.background_threads, 7777); - ASSERT_EQ (merged_config.node.bootstrap_ascending.block_processor_threshold, 33333); + ASSERT_EQ (merged_config.node.bootstrap.block_processor_threshold, 33333); ASSERT_TRUE (merged_config_string.find ("old_entry") == std::string::npos); } \ No newline at end of file diff --git a/nano/node/bootstrap/bootstrap_config.cpp b/nano/node/bootstrap/bootstrap_config.cpp index 705c1220a..d2397adfc 100644 --- a/nano/node/bootstrap/bootstrap_config.cpp +++ b/nano/node/bootstrap/bootstrap_config.cpp @@ -26,10 +26,10 @@ nano::error nano::account_sets_config::serialize (nano::tomlconfig & toml) const } /* - * bootstrap_ascending_config + * bootstrap_config */ -nano::error nano::bootstrap_ascending_config::deserialize (nano::tomlconfig & toml) +nano::error nano::bootstrap_config::deserialize (nano::tomlconfig & toml) { toml.get ("enable", enable); toml.get ("enable_database_scan", enable_database_scan); @@ -56,7 +56,7 @@ nano::error nano::bootstrap_ascending_config::deserialize (nano::tomlconfig & to return toml.get_error (); } -nano::error nano::bootstrap_ascending_config::serialize (nano::tomlconfig & toml) const +nano::error nano::bootstrap_config::serialize (nano::tomlconfig & toml) const { toml.put ("enable", enable, "Enable or disable the ascending bootstrap. Disabling it is not recommended and will prevent the node from syncing.\ntype:bool"); toml.put ("enable_database_scan", enable_database_scan, "Enable or disable the 'database scan` strategy for the ascending bootstrap.\ntype:bool"); diff --git a/nano/node/bootstrap/bootstrap_config.hpp b/nano/node/bootstrap/bootstrap_config.hpp index 1d951e696..d5e6b46d4 100644 --- a/nano/node/bootstrap/bootstrap_config.hpp +++ b/nano/node/bootstrap/bootstrap_config.hpp @@ -8,7 +8,6 @@ namespace nano { class tomlconfig; -// TODO: This should be moved next to `account_sets` class class account_sets_config final { public: @@ -22,7 +21,6 @@ public: std::chrono::milliseconds cooldown{ 1000 * 3 }; }; -// TODO: This should be moved next to `frontier_scan` class class frontier_scan_config final { public: @@ -35,8 +33,7 @@ public: std::size_t max_pending{ 16 }; }; -// TODO: This should be moved next to `bootstrap_ascending` class -class bootstrap_ascending_config final +class bootstrap_config final { public: nano::error deserialize (nano::tomlconfig & toml); diff --git a/nano/node/bootstrap/bootstrap_service.cpp b/nano/node/bootstrap/bootstrap_service.cpp index fa471c151..901f2746e 100644 --- a/nano/node/bootstrap/bootstrap_service.cpp +++ b/nano/node/bootstrap/bootstrap_service.cpp @@ -18,7 +18,7 @@ using namespace std::chrono_literals; nano::bootstrap_service::bootstrap_service (nano::node_config const & node_config_a, nano::block_processor & block_processor_a, nano::ledger & ledger_a, nano::network & network_a, nano::stats & stat_a, nano::logger & logger_a) : - config{ node_config_a.bootstrap_ascending }, + config{ node_config_a.bootstrap }, network_constants{ node_config_a.network_params.network }, block_processor{ block_processor_a }, ledger{ ledger_a }, diff --git a/nano/node/bootstrap/bootstrap_service.hpp b/nano/node/bootstrap/bootstrap_service.hpp index 9d58dc44f..f73e49a63 100644 --- a/nano/node/bootstrap/bootstrap_service.hpp +++ b/nano/node/bootstrap/bootstrap_service.hpp @@ -53,7 +53,7 @@ public: nano::bootstrap::account_sets::info_t info () const; private: // Dependencies - bootstrap_ascending_config const & config; + bootstrap_config const & config; nano::network_constants const & network_constants; nano::block_processor & block_processor; nano::ledger & ledger; diff --git a/nano/node/bootstrap/peer_scoring.cpp b/nano/node/bootstrap/peer_scoring.cpp index eb844af04..31c5164b8 100644 --- a/nano/node/bootstrap/peer_scoring.cpp +++ b/nano/node/bootstrap/peer_scoring.cpp @@ -6,7 +6,7 @@ * peer_scoring */ -nano::bootstrap::peer_scoring::peer_scoring (bootstrap_ascending_config const & config_a, nano::network_constants const & network_constants_a) : +nano::bootstrap::peer_scoring::peer_scoring (bootstrap_config const & config_a, nano::network_constants const & network_constants_a) : config{ config_a }, network_constants{ network_constants_a } { diff --git a/nano/node/bootstrap/peer_scoring.hpp b/nano/node/bootstrap/peer_scoring.hpp index 7b877faf9..43eaa4e62 100644 --- a/nano/node/bootstrap/peer_scoring.hpp +++ b/nano/node/bootstrap/peer_scoring.hpp @@ -14,15 +14,13 @@ namespace mi = boost::multi_index; namespace nano { -class bootstrap_ascending_config; - namespace bootstrap { // Container for tracking and scoring peers with respect to bootstrapping class peer_scoring { public: - peer_scoring (bootstrap_ascending_config const &, nano::network_constants const &); + peer_scoring (bootstrap_config const &, nano::network_constants const &); // Returns true if channel limit has been exceeded bool try_send_message (std::shared_ptr channel); @@ -35,7 +33,7 @@ namespace bootstrap void sync (std::deque> const & list); private: - bootstrap_ascending_config const & config; + bootstrap_config const & config; nano::network_constants const & network_constants; private: diff --git a/nano/node/fwd.hpp b/nano/node/fwd.hpp index e8b07231f..e934f6eb6 100644 --- a/nano/node/fwd.hpp +++ b/nano/node/fwd.hpp @@ -16,6 +16,7 @@ namespace nano { class active_elections; class block_processor; +class bootstrap_config; class bootstrap_server; class bootstrap_service; class confirming_set; diff --git a/nano/node/nodeconfig.cpp b/nano/node/nodeconfig.cpp index 5ceb3a6fa..c7735299e 100644 --- a/nano/node/nodeconfig.cpp +++ b/nano/node/nodeconfig.cpp @@ -214,9 +214,9 @@ nano::error nano::node_config::serialize_toml (nano::tomlconfig & toml) const priority_bucket.serialize (priority_bucket_l); toml.put_child ("priority_bucket", priority_bucket_l); - nano::tomlconfig bootstrap_ascending_l; - bootstrap_ascending.serialize (bootstrap_ascending_l); - toml.put_child ("bootstrap_ascending", bootstrap_ascending_l); + nano::tomlconfig bootstrap_l; + bootstrap.serialize (bootstrap_l); + toml.put_child ("bootstrap", bootstrap_l); nano::tomlconfig bootstrap_server_l; bootstrap_server.serialize (bootstrap_server_l); @@ -329,10 +329,10 @@ nano::error nano::node_config::deserialize_toml (nano::tomlconfig & toml) priority_bucket.deserialize (config_l); } - if (toml.has_key ("bootstrap_ascending")) + if (toml.has_key ("bootstrap")) { - auto config_l = toml.get_required_child ("bootstrap_ascending"); - bootstrap_ascending.deserialize (config_l); + auto config_l = toml.get_required_child ("bootstrap"); + bootstrap.deserialize (config_l); } if (toml.has_key ("bootstrap_server")) diff --git a/nano/node/nodeconfig.hpp b/nano/node/nodeconfig.hpp index c25700d85..57f5faed8 100644 --- a/nano/node/nodeconfig.hpp +++ b/nano/node/nodeconfig.hpp @@ -120,7 +120,7 @@ public: std::size_t bootstrap_bandwidth_limit{ 5 * 1024 * 1024 }; /** Bootstrap traffic does not need bursts */ double bootstrap_bandwidth_burst_ratio{ 1. }; - nano::bootstrap_ascending_config bootstrap_ascending; + nano::bootstrap_config bootstrap; nano::bootstrap_server_config bootstrap_server; std::chrono::milliseconds confirming_set_batch_time{ 250 }; bool backup_before_upgrade{ false };