Bugfix: node_wrapper using dev net params instead of active (issue #3447)

The node_wrapper was using dev network params instead of active network
params. This caused some CLI commands (at least --wallet_create and
wallet_list) to fail.

To fix the bug, for now, I created a local copy of network_params in
node_wrapper and initialise it with active_network.

However, it would be better to have a network_param reference passed down
so that we do not have multiple copies of network_params. I created an
issue for that improvement:
https://github.com/nanocurrency/nano-node-internalonly/issues/73
This commit is contained in:
Dimitrios Siganos 2021-09-15 16:34:21 +01:00
commit f4277a96a3
No known key found for this signature in database
GPG key ID: 403759C8B5ED69FF
2 changed files with 4 additions and 2 deletions

View file

@ -1762,8 +1762,9 @@ void nano::node::populate_backlog ()
}
nano::node_wrapper::node_wrapper (boost::filesystem::path const & path_a, boost::filesystem::path const & config_path_a, nano::node_flags const & node_flags_a) :
network_params{ nano::network_constants::active_network },
io_context (std::make_shared<boost::asio::io_context> ()),
work{ nano::dev::network_params.network, 1 }
work{ network_params.network, 1 }
{
boost::system::error_code error_chmod;
@ -1772,7 +1773,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::dev::network_params };
nano::daemon_config daemon_config{ path_a, network_params };
auto error = nano::read_node_config_toml (config_path_a, daemon_config, node_flags_a.config_overrides);
if (error)
{

View file

@ -223,6 +223,7 @@ public:
node_wrapper (boost::filesystem::path const & path_a, boost::filesystem::path const & config_path_a, nano::node_flags const & node_flags_a);
~node_wrapper ();
nano::network_params network_params;
std::shared_ptr<boost::asio::io_context> io_context;
nano::work_pool work;
std::shared_ptr<nano::node> node;