From 95177071e066b49484ff5ce398b70bc218db95a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Tue, 2 Apr 2024 15:31:25 +0200 Subject: [PATCH] USE ADD NODE --- nano/core_test/active_transactions.cpp | 20 ++--- nano/core_test/bootstrap.cpp | 118 ++++++++++++++----------- nano/core_test/bootstrap_ascending.cpp | 12 +-- nano/core_test/conflicts.cpp | 10 +-- nano/core_test/election.cpp | 15 ++-- nano/core_test/election_scheduler.cpp | 22 ++--- nano/test_common/system.cpp | 10 --- nano/test_common/system.hpp | 5 +- 8 files changed, 109 insertions(+), 103 deletions(-) diff --git a/nano/core_test/active_transactions.cpp b/nano/core_test/active_transactions.cpp index 734eeeb705..3a3e716940 100644 --- a/nano/core_test/active_transactions.cpp +++ b/nano/core_test/active_transactions.cpp @@ -238,8 +238,8 @@ TEST (active_transactions, keep_local) TEST (inactive_votes_cache, basic) { - nano::test::system system (1); - auto & node = *system.nodes[0]; + nano::test::system system; + auto & node = *system.add_node (); nano::block_hash latest (node.latest (nano::dev::genesis_key.pub)); nano::keypair key; auto send = nano::send_block_builder () @@ -262,8 +262,8 @@ TEST (inactive_votes_cache, basic) */ TEST (inactive_votes_cache, non_final) { - nano::test::system system (1); - auto & node = *system.nodes[0]; + nano::test::system system; + auto & node = *system.add_node (); auto send = nano::send_block_builder () .previous (nano::dev::genesis->hash ()) @@ -288,8 +288,8 @@ TEST (inactive_votes_cache, non_final) TEST (inactive_votes_cache, fork) { - nano::test::system system{ 1 }; - auto & node = *system.nodes[0]; + nano::test::system system; + auto & node = *system.add_node (); auto const latest = node.latest (nano::dev::genesis_key.pub); nano::keypair key{}; @@ -1033,8 +1033,8 @@ TEST (active_transactions, confirmation_consistency) TEST (active_transactions, confirm_new) { - nano::test::system system (1); - auto & node1 = *system.nodes[0]; + nano::test::system system; + auto & node1 = *system.add_node (); auto send = nano::send_block_builder () .previous (nano::dev::genesis->hash ()) .destination (nano::public_key ()) @@ -1258,8 +1258,8 @@ TEST (active_transactions, activate_inactive) TEST (active_transactions, list_active) { - nano::test::system system (1); - auto & node = *system.nodes[0]; + nano::test::system system; + auto & node = *system.add_node (); nano::keypair key; nano::state_block_builder builder; diff --git a/nano/core_test/bootstrap.cpp b/nano/core_test/bootstrap.cpp index 22c48327ad..450298454e 100644 --- a/nano/core_test/bootstrap.cpp +++ b/nano/core_test/bootstrap.cpp @@ -15,8 +15,9 @@ using namespace std::chrono_literals; // If the account doesn't exist, current == end so there's no iteration TEST (bulk_pull, no_address) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start = 1; req->end = 2; @@ -27,36 +28,39 @@ TEST (bulk_pull, no_address) TEST (bulk_pull, genesis_to_end) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start = nano::dev::genesis_key.pub; req->end.clear (); auto request (std::make_shared (connection, std::move (req))); - ASSERT_EQ (system.nodes[0]->latest (nano::dev::genesis_key.pub), request->current); + ASSERT_EQ (node->latest (nano::dev::genesis_key.pub), request->current); ASSERT_EQ (request->request->end, request->request->end); } // If we can't find the end block, send everything TEST (bulk_pull, no_end) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start = nano::dev::genesis_key.pub; req->end = 1; auto request (std::make_shared (connection, std::move (req))); - ASSERT_EQ (system.nodes[0]->latest (nano::dev::genesis_key.pub), request->current); + ASSERT_EQ (node->latest (nano::dev::genesis_key.pub), request->current); ASSERT_TRUE (request->request->end.is_zero ()); } TEST (bulk_pull, end_not_owned) { - nano::test::system system (1); + nano::test::system system; + auto node = system.add_node (); nano::keypair key2; system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); ASSERT_NE (nullptr, system.wallet (0)->send_action (nano::dev::genesis_key.pub, key2.pub, 100)); - nano::block_hash latest (system.nodes[0]->latest (nano::dev::genesis_key.pub)); + nano::block_hash latest (node->latest (nano::dev::genesis_key.pub)); nano::block_builder builder; auto open = builder .open () @@ -71,9 +75,9 @@ TEST (bulk_pull, end_not_owned) open->hashables.source = latest; open->refresh (); open->signature = nano::sign_message (key2.prv, key2.pub, open->hash ()); - system.nodes[0]->work_generate_blocking (*open); - ASSERT_EQ (nano::block_status::progress, system.nodes[0]->process (open)); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + node->work_generate_blocking (*open); + ASSERT_EQ (nano::block_status::progress, node->process (open)); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start = key2.pub; req->end = nano::dev::genesis->hash (); @@ -83,8 +87,9 @@ TEST (bulk_pull, end_not_owned) TEST (bulk_pull, none) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start = nano::dev::genesis_key.pub; req->end = nano::dev::genesis->hash (); @@ -95,8 +100,9 @@ TEST (bulk_pull, none) TEST (bulk_pull, get_next_on_open) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start = nano::dev::genesis_key.pub; req->end.clear (); @@ -112,8 +118,8 @@ TEST (bulk_pull, get_next_on_open) */ TEST (bulk_pull, ascending_one_hash) { - nano::test::system system{ 1 }; - auto & node = *system.nodes[0]; + nano::test::system system; + auto & node = *system.add_node (); nano::state_block_builder builder; auto block1 = builder .account (nano::dev::genesis_key.pub) @@ -127,7 +133,7 @@ TEST (bulk_pull, ascending_one_hash) node.work_generate_blocking (*block1); ASSERT_EQ (nano::block_status::progress, node.process (block1)); auto socket = std::make_shared (node, nano::transport::socket_endpoint::server); - auto connection = std::make_shared (socket, system.nodes[0]); + auto connection = std::make_shared (socket, node.shared ()); auto req = std::make_unique (nano::dev::network_params.network); req->start = nano::dev::genesis->hash (); req->end.clear (); @@ -144,8 +150,8 @@ TEST (bulk_pull, ascending_one_hash) */ TEST (bulk_pull, ascending_two_account) { - nano::test::system system{ 1 }; - auto & node = *system.nodes[0]; + nano::test::system system; + auto & node = *system.add_node (); nano::state_block_builder builder; auto block1 = builder .account (nano::dev::genesis_key.pub) @@ -159,7 +165,7 @@ TEST (bulk_pull, ascending_two_account) node.work_generate_blocking (*block1); ASSERT_EQ (nano::block_status::progress, node.process (block1)); auto socket = std::make_shared (node, nano::transport::socket_endpoint::server); - auto connection = std::make_shared (socket, system.nodes[0]); + auto connection = std::make_shared (socket, node.shared ()); auto req = std::make_unique (nano::dev::network_params.network); req->start = nano::dev::genesis_key.pub; req->end.clear (); @@ -179,8 +185,8 @@ TEST (bulk_pull, ascending_two_account) */ TEST (bulk_pull, ascending_end) { - nano::test::system system{ 1 }; - auto & node = *system.nodes[0]; + nano::test::system system; + auto & node = *system.add_node (); nano::state_block_builder builder; auto block1 = builder .account (nano::dev::genesis_key.pub) @@ -194,7 +200,7 @@ TEST (bulk_pull, ascending_end) node.work_generate_blocking (*block1); ASSERT_EQ (nano::block_status::progress, node.process (block1)); auto socket = std::make_shared (node, nano::transport::socket_endpoint::server); - auto connection = std::make_shared (socket, system.nodes[0]); + auto connection = std::make_shared (socket, node.shared ()); auto req = std::make_unique (nano::dev::network_params.network); req->start = nano::dev::genesis_key.pub; req->end = block1->hash (); @@ -208,8 +214,9 @@ TEST (bulk_pull, ascending_end) TEST (bulk_pull, by_block) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start = nano::dev::genesis->hash (); req->end.clear (); @@ -224,8 +231,9 @@ TEST (bulk_pull, by_block) TEST (bulk_pull, by_block_single) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start = nano::dev::genesis->hash (); req->end = nano::dev::genesis->hash (); @@ -240,7 +248,7 @@ TEST (bulk_pull, by_block_single) TEST (bulk_pull, count_limit) { - nano::test::system system (1); + nano::test::system system; auto node0 (system.nodes[0]); nano::block_builder builder; @@ -285,8 +293,8 @@ TEST (bulk_pull, count_limit) TEST (bootstrap_processor, process_none) { - nano::test::system system (1); - auto node0 = system.nodes[0]; + nano::test::system system; + auto node0 = system.add_node (); auto node1 = system.make_disconnected_node (); bool done = false; @@ -294,7 +302,7 @@ TEST (bootstrap_processor, process_none) done = true; }); - node1->bootstrap_initiator.bootstrap (system.nodes[0]->network.endpoint (), false); + node1->bootstrap_initiator.bootstrap (node0->network.endpoint (), false); ASSERT_TIMELY (5s, done); } @@ -1671,8 +1679,9 @@ TEST (frontier_req_response, DISABLED_destruction) { std::shared_ptr hold; // Destructing tcp acceptor on non-existent io_context { - nano::test::system system (1); - auto connection (std::make_shared (nullptr, system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (nullptr, node)); auto req = std::make_unique (nano::dev::network_params.network); req->start.clear (); req->age = std::numeric_limitsage)>::max (); @@ -1685,8 +1694,9 @@ TEST (frontier_req_response, DISABLED_destruction) TEST (frontier_req, begin) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start.clear (); req->age = std::numeric_limitsage)>::max (); @@ -1698,8 +1708,9 @@ TEST (frontier_req, begin) TEST (frontier_req, end) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start = nano::dev::genesis_key.pub.number () + 1; req->age = std::numeric_limitsage)>::max (); @@ -1710,7 +1721,7 @@ TEST (frontier_req, end) TEST (frontier_req, count) { - nano::test::system system (1); + nano::test::system system; auto node1 = system.nodes[0]; // Public key FB93... after genesis in accounts table nano::keypair key1 ("ED5AE0A6505B14B67435C29FD9FEEBC26F597D147BC92F6D795FFAD7AFD3D967"); @@ -1752,8 +1763,9 @@ TEST (frontier_req, count) TEST (frontier_req, time_bound) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start.clear (); req->age = 1; @@ -1766,15 +1778,16 @@ TEST (frontier_req, time_bound) req2->start.clear (); req2->age = 1; req2->count = std::numeric_limitscount)>::max (); - auto connection2 (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + auto connection2 (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto request2 (std::make_shared (connection, std::move (req2))); ASSERT_TRUE (request2->current.is_zero ()); } TEST (frontier_req, time_cutoff) { - nano::test::system system (1); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + nano::test::system system; + auto node = system.add_node (); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto req = std::make_unique (nano::dev::network_params.network); req->start.clear (); req->age = 3; @@ -1788,14 +1801,14 @@ TEST (frontier_req, time_cutoff) req2->start.clear (); req2->age = 3; req2->count = std::numeric_limitscount)>::max (); - auto connection2 (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + auto connection2 (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); auto request2 (std::make_shared (connection, std::move (req2))); ASSERT_TRUE (request2->frontier.is_zero ()); } TEST (frontier_req, confirmed_frontier) { - nano::test::system system (1); + nano::test::system system; auto node1 = system.nodes[0]; nano::keypair key_before_genesis; // Public key before genesis in accounts table @@ -2096,16 +2109,17 @@ TEST (bulk, genesis_pruning) TEST (bulk_pull_account, basics) { - nano::test::system system (1); - system.nodes[0]->config.receive_minimum = 20; + nano::test::system system; + auto node = system.add_node (); + node->config.receive_minimum = 20; nano::keypair key1; system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); system.wallet (0)->insert_adhoc (key1.prv); auto send1 (system.wallet (0)->send_action (nano::dev::genesis_key.pub, key1.pub, 25)); auto send2 (system.wallet (0)->send_action (nano::dev::genesis_key.pub, key1.pub, 10)); auto send3 (system.wallet (0)->send_action (nano::dev::genesis_key.pub, key1.pub, 2)); - ASSERT_TIMELY_EQ (5s, system.nodes[0]->balance (key1.pub), 25); - auto connection (std::make_shared (std::make_shared (*system.nodes[0], nano::transport::socket_endpoint::server), system.nodes[0])); + ASSERT_TIMELY_EQ (5s, node->balance (key1.pub), 25); + auto connection (std::make_shared (std::make_shared (*node, nano::transport::socket_endpoint::server), node)); { auto req = std::make_unique (nano::dev::network_params.network); diff --git a/nano/core_test/bootstrap_ascending.cpp b/nano/core_test/bootstrap_ascending.cpp index 59c0eb381d..3a060632db 100644 --- a/nano/core_test/bootstrap_ascending.cpp +++ b/nano/core_test/bootstrap_ascending.cpp @@ -161,8 +161,8 @@ TEST (account_sets, saturate_priority) TEST (bootstrap_ascending, account_base) { nano::node_flags flags; - nano::test::system system{ 1, nano::transport::transport_type::tcp, flags }; - auto & node0 = *system.nodes[0]; + nano::test::system system; + auto & node0 = *system.add_node (flags); nano::state_block_builder builder; auto send1 = builder.make_block () .account (nano::dev::genesis_key.pub) @@ -184,8 +184,8 @@ TEST (bootstrap_ascending, account_base) TEST (bootstrap_ascending, account_inductive) { nano::node_flags flags; - nano::test::system system{ 1, nano::transport::transport_type::tcp, flags }; - auto & node0 = *system.nodes[0]; + nano::test::system system; + auto & node0 = *system.add_node (flags); nano::state_block_builder builder; auto send1 = builder.make_block () .account (nano::dev::genesis_key.pub) @@ -221,8 +221,8 @@ TEST (bootstrap_ascending, trace_base) { nano::node_flags flags; flags.disable_legacy_bootstrap = true; - nano::test::system system{ 1, nano::transport::transport_type::tcp, flags }; - auto & node0 = *system.nodes[0]; + nano::test::system system; + auto & node0 = *system.add_node (flags); nano::keypair key; nano::state_block_builder builder; auto send1 = builder.make_block () diff --git a/nano/core_test/conflicts.cpp b/nano/core_test/conflicts.cpp index 323154046f..702c2b4fd4 100644 --- a/nano/core_test/conflicts.cpp +++ b/nano/core_test/conflicts.cpp @@ -16,8 +16,8 @@ using namespace std::chrono_literals; TEST (conflicts, start_stop) { - nano::test::system system (1); - auto & node1 (*system.nodes[0]); + nano::test::system system; + auto & node1 = *system.add_node (); nano::keypair key1; nano::block_builder builder; auto send1 = builder @@ -41,8 +41,8 @@ TEST (conflicts, start_stop) TEST (conflicts, add_existing) { - nano::test::system system{ 1 }; - auto & node1 = *system.nodes[0]; + nano::test::system system; + auto & node1 = *system.add_node (); nano::keypair key1; // create a send block to send all of the nano supply to key1 @@ -91,7 +91,7 @@ TEST (conflicts, add_existing) TEST (conflicts, add_two) { - nano::test::system system{}; + nano::test::system system; auto const & node = system.add_node (); nano::keypair key1, key2, key3; auto gk = nano::dev::genesis_key; diff --git a/nano/core_test/election.cpp b/nano/core_test/election.cpp index ac4c47a63f..596c46837a 100644 --- a/nano/core_test/election.cpp +++ b/nano/core_test/election.cpp @@ -14,24 +14,25 @@ using namespace std::chrono_literals; TEST (election, construction) { - nano::test::system system (1); - auto & node = *system.nodes[0]; + nano::test::system system; + auto & node = *system.add_node (); auto election = std::make_shared ( node, nano::dev::genesis, [] (auto const &) {}, [] (auto const &) {}, nano::election_behavior::normal); } TEST (election, behavior) { - nano::test::system system (1); - auto chain = nano::test::setup_chain (system, *system.nodes[0], 1, nano::dev::genesis_key, false); - auto election = nano::test::start_election (system, *system.nodes[0], chain[0]->hash ()); + nano::test::system system; + auto & node = *system.add_node (); + auto chain = nano::test::setup_chain (system, node, 1, nano::dev::genesis_key, false); + auto election = nano::test::start_election (system, node, chain[0]->hash ()); ASSERT_NE (nullptr, election); ASSERT_EQ (nano::election_behavior::normal, election->behavior ()); } TEST (election, quorum_minimum_flip_success) { - nano::test::system system{}; + nano::test::system system; nano::node_config node_config = system.default_config (); node_config.online_weight_minimum = nano::dev::constants.genesis_amount; @@ -273,7 +274,7 @@ TEST (election, quorum_minimum_update_weight_before_quorum_checks) TEST (election, continuous_voting) { - nano::test::system system{}; + nano::test::system system; auto & node1 = *system.add_node (); system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); diff --git a/nano/core_test/election_scheduler.cpp b/nano/core_test/election_scheduler.cpp index 48ccac7682..f616b83f24 100644 --- a/nano/core_test/election_scheduler.cpp +++ b/nano/core_test/election_scheduler.cpp @@ -15,12 +15,13 @@ using namespace std::chrono_literals; TEST (election_scheduler, construction) { - nano::test::system system{ 1 }; + nano::test::system system; } TEST (election_scheduler, activate_one_timely) { - nano::test::system system{ 1 }; + nano::test::system system; + auto node = system.add_node (); nano::state_block_builder builder; auto send1 = builder.make_block () .account (nano::dev::genesis_key.pub) @@ -31,14 +32,15 @@ TEST (election_scheduler, activate_one_timely) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .build (); - system.nodes[0]->ledger.process (system.nodes[0]->store.tx_begin_write (), send1); - system.nodes[0]->scheduler.priority.activate (nano::dev::genesis_key.pub, system.nodes[0]->store.tx_begin_read ()); - ASSERT_TIMELY (5s, system.nodes[0]->active.election (send1->qualified_root ())); + node->ledger.process (node->store.tx_begin_write (), send1); + node->scheduler.priority.activate (nano::dev::genesis_key.pub, node->store.tx_begin_read ()); + ASSERT_TIMELY (5s, node->active.election (send1->qualified_root ())); } TEST (election_scheduler, activate_one_flush) { - nano::test::system system{ 1 }; + nano::test::system system; + auto node = system.add_node (); nano::state_block_builder builder; auto send1 = builder.make_block () .account (nano::dev::genesis_key.pub) @@ -49,9 +51,9 @@ TEST (election_scheduler, activate_one_flush) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .build (); - system.nodes[0]->ledger.process (system.nodes[0]->store.tx_begin_write (), send1); - system.nodes[0]->scheduler.priority.activate (nano::dev::genesis_key.pub, system.nodes[0]->store.tx_begin_read ()); - ASSERT_TIMELY (5s, system.nodes[0]->active.election (send1->qualified_root ())); + node->ledger.process (node->store.tx_begin_write (), send1); + node->scheduler.priority.activate (nano::dev::genesis_key.pub, node->store.tx_begin_read ()); + ASSERT_TIMELY (5s, node->active.election (send1->qualified_root ())); } /** @@ -71,7 +73,7 @@ TEST (election_scheduler, activate_one_flush) */ TEST (election_scheduler, no_vacancy) { - nano::test::system system{}; + nano::test::system system; nano::node_config config = system.default_config (); config.active_elections_size = 1; diff --git a/nano/test_common/system.cpp b/nano/test_common/system.cpp index 4af8f1b749..378d1deedb 100644 --- a/nano/test_common/system.cpp +++ b/nano/test_common/system.cpp @@ -42,16 +42,6 @@ nano::test::system::system () : } } -nano::test::system::system (uint16_t count_a, nano::transport::transport_type type_a, nano::node_flags flags_a) : - system () -{ - nodes.reserve (count_a); - for (uint16_t i (0); i < count_a; ++i) - { - add_node (default_config (), flags_a, type_a); - } -} - nano::test::system::~system () { // Only stop system in destructor to avoid confusing and random bugs when debugging assertions that hit deadline expired condition diff --git a/nano/test_common/system.hpp b/nano/test_common/system.hpp index 009fea9fcc..4ce9d4a1ee 100644 --- a/nano/test_common/system.hpp +++ b/nano/test_common/system.hpp @@ -25,7 +25,6 @@ class system final { public: system (); - system (uint16_t, nano::transport::transport_type = nano::transport::transport_type::tcp, nano::node_flags = nano::node_flags ()); ~system (); void stop (); @@ -60,8 +59,8 @@ class system final * Convenience function to get a reference to a node at given index. Does bound checking. */ nano::node & node (std::size_t index) const; - std::shared_ptr add_node (nano::node_flags = nano::node_flags (), nano::transport::transport_type = nano::transport::transport_type::tcp); - std::shared_ptr add_node (nano::node_config const &, nano::node_flags = nano::node_flags (), nano::transport::transport_type = nano::transport::transport_type::tcp, std::optional const & rep = std::nullopt); + std::shared_ptr add_node (nano::node_flags = {}, nano::transport::transport_type = nano::transport::transport_type::tcp); + std::shared_ptr add_node (nano::node_config const &, nano::node_flags = {}, nano::transport::transport_type = nano::transport::transport_type::tcp, std::optional const & rep = std::nullopt); // Make an independent node that uses system resources but is not part of the system node list and does not automatically connect to other nodes std::shared_ptr make_disconnected_node (std::optional opt_node_config = std::nullopt, nano::node_flags = nano::node_flags ());