Created
February 13, 2020 18:32
-
-
Save wezrule/2fb14d1877b56c78623229ec939a7306 to your computer and use it in GitHub Desktop.
block_processor.mass_add
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST (block_processor, mass_add) | |
{ | |
nano::system system (1); | |
auto node = system.nodes.front (); | |
nano::genesis genesis; | |
nano::keypair key; | |
system.wallet (0)->insert_adhoc (nano::test_genesis_key.prv); | |
auto const num_blocks = 150000; | |
auto latest_genesis = node->latest (nano::test_genesis_key.pub); | |
std::vector<std::shared_ptr<nano::state_block>> state_blocks; | |
{ | |
for (auto i = 0; i < num_blocks; ++i) | |
{ | |
auto send (std::make_shared<nano::state_block> (nano::test_genesis_key.pub, latest_genesis, nano::test_genesis_key.pub, nano::genesis_amount - i - 1, nano::test_genesis_key.pub, nano::test_genesis_key.prv, nano::test_genesis_key.pub, *system.work.generate (latest_genesis))); | |
latest_genesis = send->hash (); | |
state_blocks.push_back (send); | |
} | |
} | |
for (auto const & block : state_blocks) | |
{ | |
node->block_processor.add (block, nano::seconds_since_epoch ()); | |
} | |
node->block_processor.flush (); | |
system.deadline_set (1000s); | |
while (node->ledger.cache.block_count != num_blocks + 1) | |
{ | |
ASSERT_NO_ERROR (system.poll ()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment