Skip to content

Commit

Permalink
Rename config to channel_limit
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Aug 8, 2024
1 parent 2bf4083 commit 38303fb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions nano/core_test/toml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ TEST (toml, daemon_config_deserialize_defaults)
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.requests_limit, defaults.node.bootstrap_ascending.requests_limit);
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.max_pull_count, defaults.node.bootstrap_ascending.max_pull_count);
ASSERT_EQ (conf.node.bootstrap_ascending.request_timeout, defaults.node.bootstrap_ascending.request_timeout);
Expand Down Expand Up @@ -593,7 +593,7 @@ TEST (toml, daemon_config_deserialize_no_defaults)
enable = false
enable_database_scan = false
enable_dependency_walker = false
requests_limit = 999
channel_limit = 999
database_rate_limit = 999
max_pull_count = 999
request_timeout = 999
Expand Down Expand Up @@ -769,7 +769,7 @@ TEST (toml, daemon_config_deserialize_no_defaults)
ASSERT_NE (conf.node.bootstrap_ascending.enable, defaults.node.bootstrap_ascending.enable);
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.requests_limit, defaults.node.bootstrap_ascending.requests_limit);
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.max_pull_count, defaults.node.bootstrap_ascending.max_pull_count);
ASSERT_NE (conf.node.bootstrap_ascending.request_timeout, defaults.node.bootstrap_ascending.request_timeout);
Expand Down
6 changes: 4 additions & 2 deletions nano/node/bootstrap/bootstrap_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/*
* account_sets_config
*/

nano::error nano::account_sets_config::deserialize (nano::tomlconfig & toml)
{
toml.get ("consideration_count", consideration_count);
Expand All @@ -27,13 +28,14 @@ nano::error nano::account_sets_config::serialize (nano::tomlconfig & toml) const
/*
* bootstrap_ascending_config
*/

nano::error nano::bootstrap_ascending_config::deserialize (nano::tomlconfig & toml)
{
toml.get ("enable", enable);
toml.get ("enable_database_scan", enable_database_scan);
toml.get ("enable_dependency_walker", enable_dependency_walker);

toml.get ("requests_limit", requests_limit);
toml.get ("channel_limit", channel_limit);
toml.get ("database_rate_limit", database_rate_limit);
toml.get ("max_pull_count", max_pull_count);
toml.get_duration ("request_timeout", request_timeout);
Expand All @@ -57,7 +59,7 @@ nano::error nano::bootstrap_ascending_config::serialize (nano::tomlconfig & toml
toml.put ("enable_database_scan", enable_database_scan, "Enable or disable the 'database scan` strategy for the ascending bootstrap.\ntype:bool");
toml.put ("enable_dependency_walker", enable_dependency_walker, "Enable or disable the 'dependency walker` strategy for the ascending bootstrap.\ntype:bool");

toml.put ("requests_limit", requests_limit, "Request limit to ascending bootstrap after which requests will be dropped.\nNote: changing to unlimited (0) is not recommended.\ntype:uint64");
toml.put ("channel_limit", channel_limit, "Maximum number of un-responded requests per channel.\nNote: changing to unlimited (0) is not recommended.\ntype:uint64");
toml.put ("database_rate_limit", database_rate_limit, "Rate limit on scanning accounts and pending entries from database.\nNote: changing to unlimited (0) is not recommended as this operation competes for resources on querying the database.\ntype:uint64");
toml.put ("max_pull_count", max_pull_count, "Maximum number of requested blocks for ascending bootstrap request.\ntype:uint64");
toml.put ("request_timeout", request_timeout.count (), "Timeout in milliseconds for incoming ascending bootstrap messages to be processed.\ntype:milliseconds");
Expand Down
2 changes: 1 addition & 1 deletion nano/node/bootstrap/bootstrap_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class bootstrap_ascending_config final
bool enable_dependency_walker{ true };

// Maximum number of un-responded requests per channel
std::size_t requests_limit{ 64 }; // TODO: => channel_requests_limit
std::size_t channel_limit{ 64 };
std::size_t database_rate_limit{ 256 };
std::size_t database_warmup_ratio{ 10 };
std::size_t max_pull_count{ nano::bootstrap_server::max_blocks };
Expand Down
2 changes: 1 addition & 1 deletion nano/node/bootstrap_ascending/peer_scoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bool nano::bootstrap_ascending::peer_scoring::try_send_message (std::shared_ptr<
}
else
{
if (existing->outstanding < config.requests_limit)
if (existing->outstanding < config.channel_limit)
{
[[maybe_unused]] auto success = index.modify (existing, [] (auto & score) {
++score.outstanding;
Expand Down

0 comments on commit 38303fb

Please sign in to comment.