Changing nano::node to hold nano::network_params by reference rather than initializing it statically.
This commit is contained in:
parent
4d1119c45f
commit
1ecefdd5d0
6 changed files with 13 additions and 9 deletions
|
|
@ -89,6 +89,7 @@ nano::node::node (boost::asio::io_context & io_ctx_a, boost::filesystem::path co
|
|||
io_ctx (io_ctx_a),
|
||||
node_initialized_latch (1),
|
||||
config (config_a),
|
||||
network_params{ config.network_params },
|
||||
stats (config.stat_config),
|
||||
workers (std::max (3u, config.io_threads / 4), nano::thread_role::name::worker),
|
||||
flags (flags_a),
|
||||
|
|
|
|||
|
|
@ -154,8 +154,8 @@ public:
|
|||
nano::write_database_queue write_database_queue;
|
||||
boost::asio::io_context & io_ctx;
|
||||
boost::latch node_initialized_latch;
|
||||
nano::network_params network_params;
|
||||
nano::node_config config;
|
||||
nano::network_params & network_params;
|
||||
nano::stat stats;
|
||||
nano::thread_pool workers;
|
||||
std::shared_ptr<nano::websocket::listener> websocket_server;
|
||||
|
|
|
|||
|
|
@ -21,14 +21,15 @@ const std::string default_test_peer_network = nano::get_env_or_default ("NANO_TE
|
|||
}
|
||||
|
||||
nano::node_config::node_config () :
|
||||
node_config (0, nano::logging ())
|
||||
node_config (0, nano::logging (), nano::dev::network_params)
|
||||
{
|
||||
}
|
||||
|
||||
nano::node_config::node_config (uint16_t peering_port_a, nano::logging const & logging_a) :
|
||||
peering_port (peering_port_a),
|
||||
logging (logging_a),
|
||||
external_address (boost::asio::ip::address_v6{}.to_string ())
|
||||
nano::node_config::node_config (uint16_t peering_port_a, nano::logging const & logging_a, nano::network_params network_params) :
|
||||
network_params{ network_params },
|
||||
peering_port{ peering_port_a },
|
||||
logging{ logging_a },
|
||||
external_address{ boost::asio::ip::address_v6{}.to_string () }
|
||||
{
|
||||
// The default constructor passes 0 to indicate we should use the default port,
|
||||
// which is determined at node startup based on active network.
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class node_config
|
|||
{
|
||||
public:
|
||||
node_config ();
|
||||
node_config (uint16_t, nano::logging const &);
|
||||
node_config (uint16_t, nano::logging const &, nano::network_params network_params = nano::dev::network_params);
|
||||
nano::error serialize_json (nano::jsonconfig &) const;
|
||||
nano::error deserialize_json (bool &, nano::jsonconfig &);
|
||||
nano::error serialize_toml (nano::tomlconfig &) const;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ std::string const test_canary_public_key_data = nano::get_env_or_default ("NANO_
|
|||
}
|
||||
|
||||
nano::keypair nano::dev::genesis_key{ dev_private_key_data };
|
||||
nano::ledger_constants nano::dev::constants{ nano::networks::nano_dev_network };
|
||||
nano::network_params nano::dev::network_params{ nano::networks::nano_dev_network };
|
||||
nano::ledger_constants & nano::dev::constants{ network_params.ledger };
|
||||
std::shared_ptr<nano::block> & nano::dev::genesis = nano::dev::constants.genesis;
|
||||
|
||||
nano::network_params::network_params () :
|
||||
|
|
|
|||
|
|
@ -395,7 +395,8 @@ public:
|
|||
namespace dev
|
||||
{
|
||||
extern nano::keypair genesis_key;
|
||||
extern nano::ledger_constants constants;
|
||||
extern nano::network_params network_params;
|
||||
extern nano::ledger_constants & constants;
|
||||
extern std::shared_ptr<nano::block> & genesis;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue