Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix daemon_config active_network. #3422

Merged
merged 1 commit into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nano/core_test/toml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ TEST (toml, daemon_config_update_array)
{
nano::tomlconfig t;
boost::filesystem::path data_path (".");
nano::daemon_config c (data_path);
nano::daemon_config c{ data_path, nano::dev::network_params };
c.node.preconfigured_peers.push_back ("dev-peer.org");
c.serialize_toml (t);
c.deserialize_toml (t);
Expand Down
3 changes: 2 additions & 1 deletion nano/load_test/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ constexpr auto ipc_port_start = 62000;

void write_config_files (boost::filesystem::path const & data_path, int index)
{
nano::daemon_config daemon_config (data_path);
nano::network_params network_params{ nano::network_constants::active_network };
nano::daemon_config daemon_config{ data_path, network_params };
daemon_config.node.peering_port = peering_port_start + index;
daemon_config.node.ipc_config.transport_tcp.enabled = true;
daemon_config.node.ipc_config.transport_tcp.port = ipc_port_start + index;
Expand Down
5 changes: 3 additions & 2 deletions nano/nano_node/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ constexpr std::size_t OPEN_FILE_DESCRIPTORS_LIMIT = 16384;

static void load_and_set_bandwidth_params (std::shared_ptr<nano::node> const & node, boost::filesystem::path const & data_path, nano::node_flags const & flags)
{
nano::daemon_config config (data_path);
nano::daemon_config config{ data_path, node->network_params };

auto error = nano::read_node_config_toml (data_path, config, flags.config_overrides);
if (!error)
Expand All @@ -48,7 +48,8 @@ void nano_daemon::daemon::run (boost::filesystem::path const & data_path, nano::
boost::system::error_code error_chmod;
nano::set_secure_perm_directory (data_path, error_chmod);
std::unique_ptr<nano::thread_runner> runner;
nano::daemon_config config (data_path);
nano::network_params network_params{ nano::network_constants::active_network };
nano::daemon_config config{ data_path, network_params };
auto error = nano::read_node_config_toml (data_path, config, flags.config_overrides);
nano::set_use_memory_pools (config.node.use_memory_pools);
if (!error)
Expand Down
2 changes: 1 addition & 1 deletion nano/nano_node/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ int main (int argc, char * const * argv)
{
config_overrides = nano::config_overrides (config->second.as<std::vector<nano::config_key_value_pair>> ());
}
nano::daemon_config daemon_config (data_path);
nano::daemon_config daemon_config{ data_path, network_params };
auto error = nano::read_node_config_toml (data_path, daemon_config, config_overrides);

nano::node_config config1 = daemon_config.node;
Expand Down
3 changes: 2 additions & 1 deletion nano/nano_wallet/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ int run_wallet (QApplication & application, int argc, char * const * argv, boost
splash->showMessage (QSplashScreen::tr ("Remember - Back Up Your Wallet Seed"), Qt::AlignBottom | Qt::AlignHCenter, Qt::darkGray);
application.processEvents ();

nano::daemon_config config (data_path);
nano::network_params network_params{ nano::network_constants::active_network };
nano::daemon_config config{ data_path, network_params };
nano::wallet_config wallet_config;

auto error = nano::read_node_config_toml (data_path, config, flags.config_overrides);
Expand Down
6 changes: 4 additions & 2 deletions nano/node/cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ std::error_code nano::handle_node_options (boost::program_options::variables_map
if (type == "node")
{
valid_type = true;
nano::daemon_config config (data_path);
nano::network_params network_params{ nano::network_constants::active_network };
nano::daemon_config config{ data_path, network_params };
config.serialize_toml (toml);
}
else if (type == "rpc")
Expand Down Expand Up @@ -1311,7 +1312,8 @@ void reset_confirmation_heights (nano::write_transaction const & transaction, na

bool is_using_rocksdb (boost::filesystem::path const & data_path, boost::program_options::variables_map const & vm, std::error_code & ec)
{
nano::daemon_config config (data_path);
nano::network_params network_params{ nano::network_constants::active_network };
nano::daemon_config config{ data_path, network_params };

// Config overriding
auto config_arg (vm.find ("config"));
Expand Down
5 changes: 3 additions & 2 deletions nano/node/daemonconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#include <sstream>
#include <vector>

nano::daemon_config::daemon_config (boost::filesystem::path const & data_path_a) :
data_path (data_path_a)
nano::daemon_config::daemon_config (boost::filesystem::path const & data_path_a, nano::network_params & network_params) :
node{ network_params },
data_path{ data_path_a }
{
}

Expand Down
2 changes: 1 addition & 1 deletion nano/node/daemonconfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class daemon_config
{
public:
daemon_config () = default;
daemon_config (boost::filesystem::path const & data_path);
daemon_config (boost::filesystem::path const & data_path, nano::network_params & network_params);
nano::error deserialize_json (bool &, nano::jsonconfig &);
nano::error serialize_json (nano::jsonconfig &);
nano::error deserialize_toml (nano::tomlconfig &);
Expand Down
2 changes: 1 addition & 1 deletion nano/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,7 @@ nano::node_wrapper::node_wrapper (boost::filesystem::path const & path_a, boost:
*/
boost::filesystem::create_directories (path_a);
nano::set_secure_perm_directory (path_a, error_chmod);
nano::daemon_config daemon_config (path_a);
nano::daemon_config daemon_config{ path_a, nano::dev::network_params };
auto error = nano::read_node_config_toml (config_path_a, daemon_config, node_flags_a.config_overrides);
if (error)
{
Expand Down