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

Use deque rather than vector to support large initialization sequences #4641

Merged
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/slow_test/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2096,7 +2096,7 @@ TEST (system, block_sequence)
size_t const pr_count = 4;
size_t const listeners_per_pr = 0;
nano::test::system system;
std::vector<nano::keypair> reps;
std::deque<nano::keypair> reps;
for (auto i = 0; i < pr_count; ++i)
{
reps.push_back (nano::keypair{});
Expand Down
2 changes: 1 addition & 1 deletion nano/test_common/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void nano::test::system::stop_node (nano::node & node)
debug_assert (!ec);
}

void nano::test::system::ledger_initialization_set (std::vector<nano::keypair> const & reps, nano::amount const & reserve)
void nano::test::system::ledger_initialization_set (std::deque<nano::keypair> const & reps, nano::amount const & reserve)
{
nano::block_hash previous = nano::dev::genesis->hash ();
auto amount = (nano::dev::constants.genesis_amount - reserve.number ()) / reps.size ();
Expand Down
4 changes: 2 additions & 2 deletions nano/test_common/system.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace test

void stop ();

void ledger_initialization_set (std::vector<nano::keypair> const & reps, nano::amount const & reserve = 0);
void ledger_initialization_set (std::deque<nano::keypair> const & reps, nano::amount const & reserve = 0);
void generate_activity (nano::node &, std::vector<nano::account> &);
void generate_mass_activity (uint32_t, nano::node &);
void generate_usage_traffic (uint32_t, uint32_t, size_t);
Expand Down Expand Up @@ -87,7 +87,7 @@ namespace test
std::chrono::time_point<std::chrono::steady_clock, std::chrono::duration<double>> deadline{ std::chrono::steady_clock::time_point::max () };
double deadline_scaling_factor{ 1.0 };
unsigned node_sequence{ 0 };
std::vector<std::shared_ptr<nano::block>> initialization_blocks;
std::deque<std::shared_ptr<nano::block>> initialization_blocks;
};

std::shared_ptr<nano::state_block> upgrade_epoch (nano::work_pool &, nano::ledger &, nano::epoch);
Expand Down
Loading