diff --git a/nano/core_test/active_transactions.cpp b/nano/core_test/active_transactions.cpp index e22cbba546..dc59f954f5 100644 --- a/nano/core_test/active_transactions.cpp +++ b/nano/core_test/active_transactions.cpp @@ -39,7 +39,7 @@ TEST (active_transactions, confirm_election_by_request) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // Process send1 locally on node1 ASSERT_TRUE (nano::test::process (node1, { send1 })); @@ -115,7 +115,7 @@ TEST (active_transactions, confirm_frontier) .link (nano::public_key ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); { // Voting node @@ -127,7 +127,7 @@ TEST (active_transactions, confirm_frontier) system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); // we cannot use the same block instance on 2 different nodes, so make a copy - auto send_copy = builder.make_block ().from (*send).build_shared (); + auto send_copy = builder.make_block ().from (*send).build (); ASSERT_TRUE (nano::test::process (node1, { send_copy })); ASSERT_TRUE (nano::test::start_elections (system, node1, { send_copy })); ASSERT_TIMELY (5s, nano::test::confirmed (node1, { send_copy })); @@ -149,7 +149,7 @@ TEST (active_transactions, confirm_frontier) node2.rep_crawler.probable_reps.emplace (nano::dev::genesis_key.pub, *peers.begin ()); } - ASSERT_EQ (nano::block_status::progress, node2.process (*send)); + ASSERT_EQ (nano::block_status::progress, node2.process (send)); ASSERT_TIMELY (5s, !node2.active.empty ()); // Save election to check request count afterwards @@ -216,7 +216,7 @@ TEST (active_transactions, keep_local) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); + .build (); const auto receive2 = builder.make_block () .account (key2.pub) .previous (0) @@ -225,7 +225,7 @@ TEST (active_transactions, keep_local) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*system.work.generate (key2.pub)) - .build_shared (); + .build (); const auto receive3 = builder.make_block () .account (key3.pub) .previous (0) @@ -234,7 +234,7 @@ TEST (active_transactions, keep_local) .link (send3->hash ()) .sign (key3.prv, key3.pub) .work (*system.work.generate (key3.pub)) - .build_shared (); + .build (); node.process_active (receive1); node.process_active (receive2); node.process_active (receive3); @@ -256,7 +256,7 @@ TEST (active_transactions, inactive_votes_cache) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto vote = nano::test::make_final_vote (nano::dev::genesis_key, { send }); node.vote_processor.vote (vote, std::make_shared (node, node)); ASSERT_TIMELY_EQ (5s, node.vote_cache.size (), 1); @@ -279,7 +279,7 @@ TEST (active_transactions, inactive_votes_cache_non_final) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // Non-final vote auto vote = std::make_shared (nano::dev::genesis_key.pub, nano::dev::genesis_key.prv, 0, 0, std::vector (1, send->hash ())); @@ -309,7 +309,7 @@ TEST (active_transactions, inactive_votes_cache_fork) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto send2 = builder.make_block () .previous (latest) @@ -317,7 +317,7 @@ TEST (active_transactions, inactive_votes_cache_fork) .balance (nano::dev::constants.genesis_amount - 200) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto const vote = nano::test::make_final_vote (nano::dev::genesis_key, { send1 }); node.vote_processor.vote (vote, std::make_shared (node, node)); @@ -349,7 +349,7 @@ TEST (active_transactions, inactive_votes_cache_existing_vote) .balance (nano::dev::constants.genesis_amount - 100 * nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto open = builder.state () .account (key.pub) .previous (0) @@ -358,7 +358,7 @@ TEST (active_transactions, inactive_votes_cache_existing_vote) .link (send->hash ()) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); node.process_active (send); node.block_processor.add (open); ASSERT_TIMELY_EQ (5s, node.active.size (), 1); @@ -404,7 +404,7 @@ TEST (active_transactions, inactive_votes_cache_multiple_votes) .balance (nano::dev::constants.genesis_amount - 100 * nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.send () .previous (send1->hash ()) @@ -412,7 +412,7 @@ TEST (active_transactions, inactive_votes_cache_multiple_votes) .balance (100 * nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); auto open = builder.state () .account (key1.pub) @@ -422,7 +422,7 @@ TEST (active_transactions, inactive_votes_cache_multiple_votes) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); + .build (); // put the blocks in the ledger witout triggering an election ASSERT_TRUE (nano::test::process (node, { send1, send2, open })); @@ -464,14 +464,14 @@ TEST (active_transactions, inactive_votes_cache_election_start) .balance (nano::dev::constants.genesis_amount - amount) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto send2 = send_block_builder.make_block () .previous (send1->hash ()) .destination (key2.pub) .balance (nano::dev::constants.genesis_amount - 2 * amount) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); auto open1 = state_block_builder.make_block () .account (key1.pub) .previous (0) @@ -480,7 +480,7 @@ TEST (active_transactions, inactive_votes_cache_election_start) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); + .build (); auto open2 = state_block_builder.make_block () .account (key2.pub) .previous (0) @@ -489,11 +489,11 @@ TEST (active_transactions, inactive_votes_cache_election_start) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*system.work.generate (key2.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*send1)); - ASSERT_EQ (nano::block_status::progress, node.process (*send2)); - ASSERT_EQ (nano::block_status::progress, node.process (*open1)); - ASSERT_EQ (nano::block_status::progress, node.process (*open2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (send1)); + ASSERT_EQ (nano::block_status::progress, node.process (send2)); + ASSERT_EQ (nano::block_status::progress, node.process (open1)); + ASSERT_EQ (nano::block_status::progress, node.process (open2)); ASSERT_TIMELY_EQ (5s, 5, node.ledger.cache.block_count); ASSERT_TRUE (node.active.empty ()); ASSERT_EQ (1, node.ledger.cache.cemented_count); @@ -504,14 +504,14 @@ TEST (active_transactions, inactive_votes_cache_election_start) .balance (send2->balance ().number () - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send2->hash ())) - .build_shared (); + .build (); auto send4 = send_block_builder.make_block () .previous (send3->hash ()) .destination (nano::keypair ().pub) .balance (send3->balance ().number () - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send3->hash ())) - .build_shared (); + .build (); // Inactive votes auto vote1 = nano::test::make_vote (key1, { open1, open2, send4 }); @@ -569,7 +569,7 @@ TEST (active_transactions, vote_replays) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); ASSERT_NE (nullptr, send1); // create open block for key receing Gxrb_ratio raw @@ -581,7 +581,7 @@ TEST (active_transactions, vote_replays) .link (send1->hash ()) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); ASSERT_NE (nullptr, open1); // wait for elections objects to appear in the AEC @@ -616,7 +616,7 @@ TEST (active_transactions, vote_replays) .link (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (open1->hash ())) - .build_shared (); + .build (); ASSERT_NE (nullptr, send2); node.process_active (send2); ASSERT_TRUE (nano::test::start_elections (system, node, { send2 })); @@ -726,7 +726,7 @@ TEST (active_transactions, republish_winner) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1.process_active (send1); ASSERT_TIMELY (5s, nano::test::exists (node1, { send1 })); @@ -743,7 +743,7 @@ TEST (active_transactions, republish_winner) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1.process_active (fork); ASSERT_TIMELY (5s, node1.active.active (*fork)); } @@ -759,7 +759,7 @@ TEST (active_transactions, republish_winner) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1.process_active (fork); ASSERT_TIMELY (5s, node1.active.active (fork->hash ())); @@ -793,7 +793,7 @@ TEST (active_transactions, fork_filter_cleanup) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_hash)) - .build_shared (); + .build (); std::vector send_block_bytes{}; { @@ -812,7 +812,7 @@ TEST (active_transactions, fork_filter_cleanup) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_hash)) - .build_shared (); + .build (); node1.process_active (fork); ASSERT_TIMELY (5s, node1.active.election (fork->qualified_root ()) != nullptr); @@ -882,7 +882,7 @@ TEST (active_transactions, fork_replacement_tally) .link (keys[i].pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); node1.process_active (send); latest = send->hash (); auto open = builder.make_block () @@ -893,7 +893,7 @@ TEST (active_transactions, fork_replacement_tally) .link (send->hash ()) .sign (keys[i].prv, keys[i].pub) .work (*system.work.generate (keys[i].pub)) - .build_shared (); + .build (); node1.process_active (open); // Confirmation auto vote = nano::test::make_final_vote (nano::dev::genesis_key, { send, open }); @@ -910,7 +910,7 @@ TEST (active_transactions, fork_replacement_tally) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); // Forks without votes for (auto i (0); i < reps_count; i++) @@ -923,7 +923,7 @@ TEST (active_transactions, fork_replacement_tally) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); node1.process_active (fork); } @@ -943,7 +943,7 @@ TEST (active_transactions, fork_replacement_tally) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto vote = nano::test::make_vote (keys[i], { fork }, 0, 0); node1.vote_processor.vote (vote, std::make_shared (node1, node1)); node1.vote_processor.flush (); @@ -1051,7 +1051,7 @@ TEST (active_transactions, confirm_new) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1.process_active (send); ASSERT_TIMELY_EQ (5s, 1, node1.active.size ()); auto & node2 = *system.add_node (); @@ -1081,7 +1081,7 @@ TEST (active_transactions, conflicting_block_vote_existing_election) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto fork = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (nano::dev::genesis->hash ()) @@ -1090,7 +1090,7 @@ TEST (active_transactions, conflicting_block_vote_existing_election) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto vote_fork = nano::test::make_final_vote (nano::dev::genesis_key, { fork }); ASSERT_EQ (nano::block_status::progress, node.process_local (send).value ()); @@ -1163,11 +1163,11 @@ TEST (active_transactions, activate_account_chain) .sign (key.prv, key.pub) .work (*system.work.generate (open->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node.process (*send)); - ASSERT_EQ (nano::block_status::progress, node.process (*send2)); - ASSERT_EQ (nano::block_status::progress, node.process (*send3)); - ASSERT_EQ (nano::block_status::progress, node.process (*open)); - ASSERT_EQ (nano::block_status::progress, node.process (*receive)); + ASSERT_EQ (nano::block_status::progress, node.process (send)); + ASSERT_EQ (nano::block_status::progress, node.process (send2)); + ASSERT_EQ (nano::block_status::progress, node.process (send3)); + ASSERT_EQ (nano::block_status::progress, node.process (open)); + ASSERT_EQ (nano::block_status::progress, node.process (receive)); node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.store.tx_begin_read ()); ASSERT_TIMELY (5s, node.active.election (send->qualified_root ())); @@ -1226,7 +1226,7 @@ TEST (active_transactions, activate_inactive) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (send->hash ()) @@ -1235,7 +1235,7 @@ TEST (active_transactions, activate_inactive) .balance (nano::dev::constants.genesis_amount - 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send->hash ())) - .build_shared (); + .build (); auto open = builder.make_block () .account (key.pub) .previous (0) @@ -1244,11 +1244,11 @@ TEST (active_transactions, activate_inactive) .balance (1) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); - ASSERT_EQ (nano::block_status::progress, node.process (*send)); - ASSERT_EQ (nano::block_status::progress, node.process (*send2)); - ASSERT_EQ (nano::block_status::progress, node.process (*open)); + ASSERT_EQ (nano::block_status::progress, node.process (send)); + ASSERT_EQ (nano::block_status::progress, node.process (send2)); + ASSERT_EQ (nano::block_status::progress, node.process (open)); auto election = nano::test::start_election (system, node, send2->hash ()); ASSERT_NE (nullptr, election); @@ -1281,9 +1281,9 @@ TEST (active_transactions, list_active) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); - ASSERT_EQ (nano::block_status::progress, node.process (*send)); + ASSERT_EQ (nano::block_status::progress, node.process (send)); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) @@ -1293,9 +1293,9 @@ TEST (active_transactions, list_active) .balance (nano::dev::constants.genesis_amount - 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send->hash ())) - .build_shared (); + .build (); - ASSERT_EQ (nano::block_status::progress, node.process (*send2)); + ASSERT_EQ (nano::block_status::progress, node.process (send2)); auto open = builder.make_block () .account (key.pub) @@ -1305,9 +1305,9 @@ TEST (active_transactions, list_active) .balance (1) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); - ASSERT_EQ (nano::block_status::progress, node.process (*open)); + ASSERT_EQ (nano::block_status::progress, node.process (open)); ASSERT_TRUE (nano::test::start_elections (system, node, { send, send2, open })); ASSERT_EQ (3, node.active.size ()); @@ -1338,9 +1338,9 @@ TEST (active_transactions, vacancy) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node.active.vacancy_update = [&updated] () { updated = true; }; - ASSERT_EQ (nano::block_status::progress, node.process (*send)); + ASSERT_EQ (nano::block_status::progress, node.process (send)); ASSERT_EQ (1, node.active.vacancy ()); ASSERT_EQ (0, node.active.size ()); node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.store.tx_begin_read ()); @@ -1380,8 +1380,8 @@ TEST (active_transactions, fifo) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_hash)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (send1)); node.process_confirmed (nano::election_status{ send1 }); ASSERT_TIMELY (5s, node.block_confirmed (send1->hash ())); @@ -1395,8 +1395,8 @@ TEST (active_transactions, fifo) .balance (nano::dev::constants.genesis_amount - 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_hash)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (send2)); node.process_confirmed (nano::election_status{ send2 }); ASSERT_TIMELY (5s, node.block_confirmed (send2->hash ())); @@ -1408,8 +1408,8 @@ TEST (active_transactions, fifo) .balance (1) .sign (key0.prv, key0.pub) .work (*system.work.generate (key0.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*receive1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (receive1)); auto receive2 = builder.make_block () .previous (0) @@ -1419,8 +1419,8 @@ TEST (active_transactions, fifo) .balance (1) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*receive2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (receive2)); // Ensure first transaction becomes active node.scheduler.manual.push (receive1); diff --git a/nano/core_test/block.cpp b/nano/core_test/block.cpp index 7a2c37b812..2b66920826 100644 --- a/nano/core_test/block.cpp +++ b/nano/core_test/block.cpp @@ -385,7 +385,7 @@ TEST (block, publish_req_serialization) .balance (200) .sign (nano::keypair ().prv, 2) .work (3) - .build_shared (); + .build (); nano::publish req{ nano::dev::network_params.network, block }; std::vector bytes; { @@ -429,7 +429,7 @@ TEST (state_block, serialization) .link (4) .sign (key1.prv, key1.pub) .work (5) - .build_shared (); + .build (); ASSERT_EQ (key1.pub, block1->hashables.account); ASSERT_EQ (nano::block_hash (1), block1->previous ()); ASSERT_EQ (key2.pub, block1->hashables.representative); @@ -489,7 +489,7 @@ TEST (state_block, hashing) .link (0) .sign (key.prv, key.pub) .work (0) - .build_shared (); + .build (); auto hash (block->hash ()); ASSERT_EQ (hash, block->hash ()); // check cache works block->hashables.account.bytes[0] ^= 0x1; @@ -551,7 +551,7 @@ TEST (block_uniquer, single) .link (0) .sign (key.prv, key.pub) .work (0) - .build_shared (); + .build (); auto block2 (std::make_shared (*block1)); ASSERT_NE (block1, block2); ASSERT_EQ (*block1, *block2); @@ -578,7 +578,7 @@ TEST (block_uniquer, cleanup) .link (0) .sign (key.prv, key.pub) .work (0) - .build_shared (); + .build (); auto block2 = builder .make_block () .account (0) @@ -588,7 +588,7 @@ TEST (block_uniquer, cleanup) .link (0) .sign (key.prv, key.pub) .work (1) - .build_shared (); + .build (); nano::block_uniquer uniquer; auto block3 = uniquer.unique (block1); @@ -636,7 +636,7 @@ TEST (block_builder, zeroed_state_block) .link (0) .sign (key.prv, key.pub) .work (0) - .build_shared (); + .build (); auto zero_block_build = builder.state ().zero ().sign (key.prv, key.pub).build (); ASSERT_EQ (zero_block_manual->hash (), zero_block_build->hash ()); ASSERT_FALSE (nano::validate_message (key.pub, zero_block_build->hash (), zero_block_build->signature)); diff --git a/nano/core_test/block_store.cpp b/nano/core_test/block_store.cpp index fd4c78049d..6f010ee266 100644 --- a/nano/core_test/block_store.cpp +++ b/nano/core_test/block_store.cpp @@ -1021,7 +1021,7 @@ TEST (mdb_block_store, sideband_height) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); auto receive = builder .receive () .previous (send->hash ()) @@ -1029,7 +1029,7 @@ TEST (mdb_block_store, sideband_height) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive)); auto change = builder .change () .previous (receive->hash ()) @@ -1037,7 +1037,7 @@ TEST (mdb_block_store, sideband_height) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (receive->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *change)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change)); auto state_send1 = builder .state () .account (nano::dev::genesis_key.pub) @@ -1048,7 +1048,7 @@ TEST (mdb_block_store, sideband_height) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (change->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *state_send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, state_send1)); auto state_send2 = builder .state () .account (nano::dev::genesis_key.pub) @@ -1059,7 +1059,7 @@ TEST (mdb_block_store, sideband_height) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (state_send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *state_send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, state_send2)); auto state_send3 = builder .state () .account (nano::dev::genesis_key.pub) @@ -1070,7 +1070,7 @@ TEST (mdb_block_store, sideband_height) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (state_send2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *state_send3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, state_send3)); auto state_open = builder .state () .account (key1.pub) @@ -1081,7 +1081,7 @@ TEST (mdb_block_store, sideband_height) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *state_open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, state_open)); auto epoch = builder .state () .account (key1.pub) @@ -1092,7 +1092,7 @@ TEST (mdb_block_store, sideband_height) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (state_open->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch)); ASSERT_EQ (nano::epoch::epoch_1, ledger.version (*epoch)); auto epoch_open = builder .state () @@ -1104,7 +1104,7 @@ TEST (mdb_block_store, sideband_height) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch_open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch_open)); ASSERT_EQ (nano::epoch::epoch_1, ledger.version (*epoch_open)); auto state_receive = builder .state () @@ -1116,7 +1116,7 @@ TEST (mdb_block_store, sideband_height) .sign (key2.prv, key2.pub) .work (*pool.generate (epoch_open->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *state_receive)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, state_receive)); auto open = builder .open () .source (state_send3->hash ()) @@ -1125,7 +1125,7 @@ TEST (mdb_block_store, sideband_height) .sign (key3.prv, key3.pub) .work (*pool.generate (key3.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); auto block1 (store.block.get (transaction, nano::dev::genesis->hash ())); ASSERT_EQ (block1->sideband ().height, 1); auto block2 (store.block.get (transaction, send->hash ())); @@ -1673,7 +1673,7 @@ TEST (rocksdb_block_store, tombstone_count) .balance (2) .sign (nano::keypair ().prv, 4) .work (5) - .build_shared (); + .build (); // Enqueues a block to be saved in the database nano::account account{ 1 }; store->account.put (store->tx_begin_write (), account, nano::account_info{}); diff --git a/nano/core_test/blockprocessor.cpp b/nano/core_test/blockprocessor.cpp index 9bcc43a048..38ccdc65b4 100644 --- a/nano/core_test/blockprocessor.cpp +++ b/nano/core_test/blockprocessor.cpp @@ -32,7 +32,7 @@ TEST (block_processor, broadcast_block_on_arrival) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // Adds a block to the first node. process_active() -> (calls) block_processor.add() -> add() -> // awakes process_block() -> process_batch() -> process_one() -> process_live() node1->process_active (send1); diff --git a/nano/core_test/bootstrap.cpp b/nano/core_test/bootstrap.cpp index 1003a01f91..bf1045d118 100644 --- a/nano/core_test/bootstrap.cpp +++ b/nano/core_test/bootstrap.cpp @@ -69,7 +69,7 @@ TEST (bulk_pull, end_not_owned) 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)); + 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_type_t::server), system.nodes[0])); auto req = std::make_unique (nano::dev::network_params.network); req->start = key2.pub; @@ -120,9 +120,9 @@ TEST (bulk_pull, ascending_one_hash) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node.work_generate_blocking (*block1); - ASSERT_EQ (nano::block_status::progress, node.process (*block1)); + ASSERT_EQ (nano::block_status::progress, node.process (block1)); auto socket = std::make_shared (node, nano::transport::socket::endpoint_type_t::server); auto connection = std::make_shared (socket, system.nodes[0]); auto req = std::make_unique (nano::dev::network_params.network); @@ -152,9 +152,9 @@ TEST (bulk_pull, ascending_two_account) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node.work_generate_blocking (*block1); - ASSERT_EQ (nano::block_status::progress, node.process (*block1)); + ASSERT_EQ (nano::block_status::progress, node.process (block1)); auto socket = std::make_shared (node, nano::transport::socket::endpoint_type_t::server); auto connection = std::make_shared (socket, system.nodes[0]); auto req = std::make_unique (nano::dev::network_params.network); @@ -187,9 +187,9 @@ TEST (bulk_pull, ascending_end) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node.work_generate_blocking (*block1); - ASSERT_EQ (nano::block_status::progress, node.process (*block1)); + ASSERT_EQ (nano::block_status::progress, node.process (block1)); auto socket = std::make_shared (node, nano::transport::socket::endpoint_type_t::server); auto connection = std::make_shared (socket, system.nodes[0]); auto req = std::make_unique (nano::dev::network_params.network); @@ -248,16 +248,16 @@ TEST (bulk_pull, count_limit) .balance (1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (node0->latest (nano::dev::genesis_key.pub))) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node0->process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node0->process (send1)); auto receive1 = builder .receive () .previous (send1->hash ()) .source (send1->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node0->process (*receive1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node0->process (receive1)); auto connection (std::make_shared (std::make_shared (*node0, nano::transport::socket::endpoint_type_t::server), node0)); auto req = std::make_unique (nano::dev::network_params.network); @@ -361,7 +361,7 @@ TEST (bootstrap_processor, process_state) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); auto block2 = builder .make_block () .account (nano::dev::genesis_key.pub) @@ -371,12 +371,12 @@ TEST (bootstrap_processor, process_state) .link (block1->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node0->work_generate_blocking (*block1); node0->work_generate_blocking (*block2); - ASSERT_EQ (nano::block_status::progress, node0->process (*block1)); - ASSERT_EQ (nano::block_status::progress, node0->process (*block2)); + ASSERT_EQ (nano::block_status::progress, node0->process (block1)); + ASSERT_EQ (nano::block_status::progress, node0->process (block2)); ASSERT_TIMELY_EQ (5s, nano::test::account_info (*node0, nano::dev::genesis_key.pub).block_count, 3); auto node1 = system.make_disconnected_node (std::nullopt, node_flags); @@ -443,8 +443,8 @@ TEST (bootstrap_processor, pull_diamond) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (node0->latest (nano::dev::genesis_key.pub))) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node0->process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node0->process (send1)); auto open = builder .open () .source (send1->hash ()) @@ -452,8 +452,8 @@ TEST (bootstrap_processor, pull_diamond) .account (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node0->process (*open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node0->process (open)); auto send2 = builder .send () .previous (open->hash ()) @@ -461,16 +461,16 @@ TEST (bootstrap_processor, pull_diamond) .balance (std::numeric_limits::max () - 100) .sign (key.prv, key.pub) .work (*system.work.generate (open->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node0->process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node0->process (send2)); auto receive = builder .receive () .previous (send1->hash ()) .source (send2->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node0->process (*receive)); + .build (); + ASSERT_EQ (nano::block_status::progress, node0->process (receive)); auto node1 = system.make_disconnected_node (); node1->bootstrap_initiator.bootstrap (node0->network.endpoint (), false); @@ -501,7 +501,7 @@ TEST (bootstrap_processor, DISABLED_pull_requeue_network_error) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1->bootstrap_initiator.bootstrap (node2->network.endpoint ()); auto attempt (node1->bootstrap_initiator.current_attempt ()); @@ -540,8 +540,8 @@ TEST (bootstrap_processor, push_diamond) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send1)); // open key account receiving all balance of genesis auto open = builder @@ -551,8 +551,8 @@ TEST (bootstrap_processor, push_diamond) .account (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); // send from key to genesis 100 raw auto send2 = builder @@ -562,8 +562,8 @@ TEST (bootstrap_processor, push_diamond) .balance (std::numeric_limits::max () - 100) .sign (key.prv, key.pub) .work (*system.work.generate (open->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send2)); // receive the 100 raw on genesis auto receive = builder @@ -572,8 +572,8 @@ TEST (bootstrap_processor, push_diamond) .source (send2->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*receive)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (receive)); nano::node_config config = system.default_config (); config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled; @@ -613,8 +613,8 @@ TEST (bootstrap_processor, push_diamond_pruning) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send1)); // receive all balance on key auto open = builder @@ -624,8 +624,8 @@ TEST (bootstrap_processor, push_diamond_pruning) .account (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); // 1st bootstrap node1->bootstrap_initiator.bootstrap (node0->network.endpoint (), false); @@ -642,8 +642,8 @@ TEST (bootstrap_processor, push_diamond_pruning) .balance (std::numeric_limits::max () - 100) .sign (key.prv, key.pub) .work (*system.work.generate (open->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send2)); // receive the 100 raw from key on genesis auto receive = builder @@ -652,8 +652,8 @@ TEST (bootstrap_processor, push_diamond_pruning) .source (send2->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*receive)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (receive)); { auto transaction (node1->store.tx_begin_write ()); @@ -722,7 +722,7 @@ TEST (bootstrap_processor, lazy_hash) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto receive1 = builder .make_block () .account (key1.pub) @@ -732,7 +732,7 @@ TEST (bootstrap_processor, lazy_hash) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (key1.pub)) - .build_shared (); + .build (); auto send2 = builder .make_block () .account (key1.pub) @@ -742,7 +742,7 @@ TEST (bootstrap_processor, lazy_hash) .link (key2.pub) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (receive1->hash ())) - .build_shared (); + .build (); auto receive2 = builder .make_block () .account (key2.pub) @@ -752,7 +752,7 @@ TEST (bootstrap_processor, lazy_hash) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*node0->work_generate_blocking (key2.pub)) - .build_shared (); + .build (); // Processing test chain node0->block_processor.add (send1); @@ -797,7 +797,7 @@ TEST (bootstrap_processor, lazy_hash_bootstrap_id) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto receive1 = builder .make_block () .account (key1.pub) @@ -807,7 +807,7 @@ TEST (bootstrap_processor, lazy_hash_bootstrap_id) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (key1.pub)) - .build_shared (); + .build (); auto send2 = builder .make_block () .account (key1.pub) @@ -817,7 +817,7 @@ TEST (bootstrap_processor, lazy_hash_bootstrap_id) .link (key2.pub) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (receive1->hash ())) - .build_shared (); + .build (); auto receive2 = builder .make_block () .account (key2.pub) @@ -827,7 +827,7 @@ TEST (bootstrap_processor, lazy_hash_bootstrap_id) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*node0->work_generate_blocking (key2.pub)) - .build_shared (); + .build (); // Processing test chain node0->block_processor.add (send1); @@ -872,7 +872,7 @@ TEST (bootstrap_processor, lazy_hash_pruning) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // receive send1 auto receive1 = builder @@ -884,7 +884,7 @@ TEST (bootstrap_processor, lazy_hash_pruning) .link (send1->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (send1->hash ())) - .build_shared (); + .build (); // change rep of genesis account to be key1 nano::keypair key1; @@ -897,7 +897,7 @@ TEST (bootstrap_processor, lazy_hash_pruning) .link (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (receive1->hash ())) - .build_shared (); + .build (); // change rep of genesis account to be rep2 nano::keypair key2; @@ -910,7 +910,7 @@ TEST (bootstrap_processor, lazy_hash_pruning) .link (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (change1->hash ())) - .build_shared (); + .build (); // send Gxrb_ratio from genesis to key1 and genesis rep back to genesis account auto send2 = builder @@ -922,7 +922,7 @@ TEST (bootstrap_processor, lazy_hash_pruning) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (change2->hash ())) - .build_shared (); + .build (); // receive send2 and rep of key1 to be itself auto receive2 = builder @@ -934,7 +934,7 @@ TEST (bootstrap_processor, lazy_hash_pruning) .link (send2->hash ()) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (key1.pub)) - .build_shared (); + .build (); // send Gxrb_ratio raw, all available balance, from key1 to key2 auto send3 = builder @@ -946,7 +946,7 @@ TEST (bootstrap_processor, lazy_hash_pruning) .link (key2.pub) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (receive2->hash ())) - .build_shared (); + .build (); // receive send3 on key2, set rep of key2 to be itself auto receive3 = builder @@ -958,7 +958,7 @@ TEST (bootstrap_processor, lazy_hash_pruning) .link (send3->hash ()) .sign (key2.prv, key2.pub) .work (*node0->work_generate_blocking (key2.pub)) - .build_shared (); + .build (); std::vector> blocks = { send1, receive1, change1, change2, send2, receive2, send3, receive3 }; ASSERT_TRUE (nano::test::process (*node0, blocks)); @@ -1025,7 +1025,7 @@ TEST (bootstrap_processor, lazy_max_pull_count) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto receive1 = builder .make_block () .account (key1.pub) @@ -1035,7 +1035,7 @@ TEST (bootstrap_processor, lazy_max_pull_count) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (key1.pub)) - .build_shared (); + .build (); auto send2 = builder .make_block () .account (key1.pub) @@ -1045,7 +1045,7 @@ TEST (bootstrap_processor, lazy_max_pull_count) .link (key2.pub) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (receive1->hash ())) - .build_shared (); + .build (); auto receive2 = builder .make_block () .account (key2.pub) @@ -1055,7 +1055,7 @@ TEST (bootstrap_processor, lazy_max_pull_count) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*node0->work_generate_blocking (key2.pub)) - .build_shared (); + .build (); auto change1 = builder .make_block () .account (key2.pub) @@ -1065,7 +1065,7 @@ TEST (bootstrap_processor, lazy_max_pull_count) .link (0) .sign (key2.prv, key2.pub) .work (*node0->work_generate_blocking (receive2->hash ())) - .build_shared (); + .build (); auto change2 = builder .make_block () .account (key2.pub) @@ -1075,7 +1075,7 @@ TEST (bootstrap_processor, lazy_max_pull_count) .link (0) .sign (key2.prv, key2.pub) .work (*node0->work_generate_blocking (change1->hash ())) - .build_shared (); + .build (); auto change3 = builder .make_block () .account (key2.pub) @@ -1085,7 +1085,7 @@ TEST (bootstrap_processor, lazy_max_pull_count) .link (0) .sign (key2.prv, key2.pub) .work (*node0->work_generate_blocking (change2->hash ())) - .build_shared (); + .build (); // Processing test chain node0->block_processor.add (send1); node0->block_processor.add (receive1); @@ -1129,8 +1129,8 @@ TEST (bootstrap_processor, lazy_unclear_state_link) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send1)); auto send2 = builder .state () .account (nano::dev::genesis_key.pub) @@ -1140,8 +1140,8 @@ TEST (bootstrap_processor, lazy_unclear_state_link) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send2)); auto open = builder .open () .source (send1->hash ()) @@ -1149,8 +1149,8 @@ TEST (bootstrap_processor, lazy_unclear_state_link) .account (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); auto receive = builder .state () .account (key.pub) @@ -1160,8 +1160,8 @@ TEST (bootstrap_processor, lazy_unclear_state_link) .link (send2->hash ()) .sign (key.prv, key.pub) .work (*system.work.generate (open->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*receive)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (receive)); ASSERT_TIMELY (5s, nano::test::exists (*node1, { send1, send2, open, receive })); @@ -1199,8 +1199,8 @@ TEST (bootstrap_processor, lazy_unclear_state_link_not_existing) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send1)); auto open = builder .open () .source (send1->hash ()) @@ -1208,8 +1208,8 @@ TEST (bootstrap_processor, lazy_unclear_state_link_not_existing) .account (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); auto send2 = builder .state () .account (key.pub) @@ -1219,8 +1219,8 @@ TEST (bootstrap_processor, lazy_unclear_state_link_not_existing) .link (key2.pub) .sign (key.prv, key.pub) .work (*system.work.generate (open->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send2)); // Start lazy bootstrap with last block in chain known auto node2 = system.make_disconnected_node (std::nullopt, node_flags); @@ -1258,8 +1258,8 @@ TEST (bootstrap_processor, lazy_destinations) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send1)); // send Gxrb_ratio raw from genesis to key2 auto send2 = builder @@ -1271,8 +1271,8 @@ TEST (bootstrap_processor, lazy_destinations) .link (key2.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send2)); // receive send1 on key1 auto open = builder @@ -1282,8 +1282,8 @@ TEST (bootstrap_processor, lazy_destinations) .account (key1.pub) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); // receive send2 on key2 auto state_open = builder @@ -1295,8 +1295,8 @@ TEST (bootstrap_processor, lazy_destinations) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*system.work.generate (key2.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*state_open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (state_open)); // Start lazy bootstrap with last block in sender chain auto node2 = system.make_disconnected_node (std::nullopt, node_flags); @@ -1339,7 +1339,7 @@ TEST (bootstrap_processor, lazy_pruning_missing_block) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1->process_active (send1); // send from genesis to key2 @@ -1352,7 +1352,7 @@ TEST (bootstrap_processor, lazy_pruning_missing_block) .link (key2.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); node1->process_active (send2); // open account key1 @@ -1363,7 +1363,7 @@ TEST (bootstrap_processor, lazy_pruning_missing_block) .account (key1.pub) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); + .build (); node1->process_active (open); // open account key2 @@ -1376,7 +1376,7 @@ TEST (bootstrap_processor, lazy_pruning_missing_block) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*system.work.generate (key2.pub)) - .build_shared (); + .build (); node1->process_active (state_open); ASSERT_TIMELY (5s, node1->block (state_open->hash ()) != nullptr); @@ -1440,7 +1440,7 @@ TEST (bootstrap_processor, lazy_cancel) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // Start lazy bootstrap with last block in chain known auto node1 = system.make_disconnected_node (); @@ -1481,7 +1481,7 @@ TEST (bootstrap_processor, wallet_lazy_frontier) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto receive1 = builder .make_block () .account (key1.pub) @@ -1491,7 +1491,7 @@ TEST (bootstrap_processor, wallet_lazy_frontier) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (key1.pub)) - .build_shared (); + .build (); auto send2 = builder .make_block () .account (key1.pub) @@ -1501,7 +1501,7 @@ TEST (bootstrap_processor, wallet_lazy_frontier) .link (key2.pub) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (receive1->hash ())) - .build_shared (); + .build (); auto receive2 = builder .make_block () .account (key2.pub) @@ -1511,7 +1511,7 @@ TEST (bootstrap_processor, wallet_lazy_frontier) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*node0->work_generate_blocking (key2.pub)) - .build_shared (); + .build (); // Processing test chain node0->block_processor.add (send1); @@ -1562,7 +1562,7 @@ TEST (bootstrap_processor, wallet_lazy_pending) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto receive1 = builder .make_block () .account (key1.pub) @@ -1572,7 +1572,7 @@ TEST (bootstrap_processor, wallet_lazy_pending) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (key1.pub)) - .build_shared (); + .build (); auto send2 = builder .make_block () .account (key1.pub) @@ -1582,7 +1582,7 @@ TEST (bootstrap_processor, wallet_lazy_pending) .link (key2.pub) .sign (key1.prv, key1.pub) .work (*node0->work_generate_blocking (receive1->hash ())) - .build_shared (); + .build (); // Processing test chain node0->block_processor.add (send1); @@ -1623,7 +1623,7 @@ TEST (bootstrap_processor, multiple_attempts) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto receive1 = builder .make_block () .account (key1.pub) @@ -1633,7 +1633,7 @@ TEST (bootstrap_processor, multiple_attempts) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*node1->work_generate_blocking (key1.pub)) - .build_shared (); + .build (); auto send2 = builder .make_block () .account (key1.pub) @@ -1643,7 +1643,7 @@ TEST (bootstrap_processor, multiple_attempts) .link (key2.pub) .sign (key1.prv, key1.pub) .work (*node1->work_generate_blocking (receive1->hash ())) - .build_shared (); + .build (); auto receive2 = builder .make_block () .account (key2.pub) @@ -1653,7 +1653,7 @@ TEST (bootstrap_processor, multiple_attempts) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*node1->work_generate_blocking (key2.pub)) - .build_shared (); + .build (); // Processing test chain node1->block_processor.add (send1); @@ -1742,9 +1742,9 @@ TEST (frontier_req, count) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1->work_generate_blocking (*send1); - ASSERT_EQ (nano::block_status::progress, node1->process (*send1)); + ASSERT_EQ (nano::block_status::progress, node1->process (send1)); auto receive1 = builder .make_block () .account (key1.pub) @@ -1754,9 +1754,9 @@ TEST (frontier_req, count) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (0) - .build_shared (); + .build (); node1->work_generate_blocking (*receive1); - ASSERT_EQ (nano::block_status::progress, node1->process (*receive1)); + ASSERT_EQ (nano::block_status::progress, node1->process (receive1)); auto connection (std::make_shared (std::make_shared (*node1, nano::transport::socket::endpoint_type_t::server), node1)); auto req = std::make_unique (nano::dev::network_params.network); @@ -1837,9 +1837,9 @@ TEST (frontier_req, confirmed_frontier) .link (key_before_genesis.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1->work_generate_blocking (*send1); - ASSERT_EQ (nano::block_status::progress, node1->process (*send1)); + ASSERT_EQ (nano::block_status::progress, node1->process (send1)); auto send2 = builder .make_block () .account (nano::dev::genesis_key.pub) @@ -1849,9 +1849,9 @@ TEST (frontier_req, confirmed_frontier) .link (key_after_genesis.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1->work_generate_blocking (*send2); - ASSERT_EQ (nano::block_status::progress, node1->process (*send2)); + ASSERT_EQ (nano::block_status::progress, node1->process (send2)); auto receive1 = builder .make_block () .account (key_before_genesis.pub) @@ -1861,9 +1861,9 @@ TEST (frontier_req, confirmed_frontier) .link (send1->hash ()) .sign (key_before_genesis.prv, key_before_genesis.pub) .work (0) - .build_shared (); + .build (); node1->work_generate_blocking (*receive1); - ASSERT_EQ (nano::block_status::progress, node1->process (*receive1)); + ASSERT_EQ (nano::block_status::progress, node1->process (receive1)); auto receive2 = builder .make_block () .account (key_after_genesis.pub) @@ -1873,9 +1873,9 @@ TEST (frontier_req, confirmed_frontier) .link (send2->hash ()) .sign (key_after_genesis.prv, key_after_genesis.pub) .work (0) - .build_shared (); + .build (); node1->work_generate_blocking (*receive2); - ASSERT_EQ (nano::block_status::progress, node1->process (*receive2)); + ASSERT_EQ (nano::block_status::progress, node1->process (receive2)); // Request for all accounts (confirmed only) auto connection (std::make_shared (std::make_shared (*node1, nano::transport::socket::endpoint_type_t::server), node1)); diff --git a/nano/core_test/bootstrap_ascending.cpp b/nano/core_test/bootstrap_ascending.cpp index 3f8059cdd1..a9ca258454 100644 --- a/nano/core_test/bootstrap_ascending.cpp +++ b/nano/core_test/bootstrap_ascending.cpp @@ -170,8 +170,8 @@ TEST (bootstrap_ascending, account_base) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node0.process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node0.process (send1)); auto & node1 = *system.add_node (flags); ASSERT_TIMELY (5s, node1.block (send1->hash ()) != nullptr); } @@ -193,7 +193,7 @@ TEST (bootstrap_ascending, account_inductive) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (send1->hash ()) @@ -202,12 +202,12 @@ TEST (bootstrap_ascending, account_inductive) .balance (nano::dev::constants.genesis_amount - 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); // std::cerr << "Genesis: " << nano::dev::genesis->hash ().to_string () << std::endl; // std::cerr << "Send1: " << send1->hash ().to_string () << std::endl; // std::cerr << "Send2: " << send2->hash ().to_string () << std::endl; - ASSERT_EQ (nano::block_status::progress, node0.process (*send1)); - ASSERT_EQ (nano::block_status::progress, node0.process (*send2)); + ASSERT_EQ (nano::block_status::progress, node0.process (send1)); + ASSERT_EQ (nano::block_status::progress, node0.process (send2)); auto & node1 = *system.add_node (flags); ASSERT_TIMELY (50s, node1.block (send2->hash ()) != nullptr); } @@ -231,7 +231,7 @@ TEST (bootstrap_ascending, trace_base) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto receive1 = builder.make_block () .account (key.pub) .previous (0) @@ -240,7 +240,7 @@ TEST (bootstrap_ascending, trace_base) .balance (1) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); // std::cerr << "Genesis key: " << nano::dev::genesis_key.pub.to_account () << std::endl; // std::cerr << "Key: " << key.pub.to_account () << std::endl; // std::cerr << "Genesis: " << nano::dev::genesis->hash ().to_string () << std::endl; @@ -248,8 +248,8 @@ TEST (bootstrap_ascending, trace_base) // std::cerr << "receive1: " << receive1->hash ().to_string () << std::endl; auto & node1 = *system.add_node (); // std::cerr << "--------------- Start ---------------\n"; - ASSERT_EQ (nano::block_status::progress, node0.process (*send1)); - ASSERT_EQ (nano::block_status::progress, node0.process (*receive1)); + ASSERT_EQ (nano::block_status::progress, node0.process (send1)); + ASSERT_EQ (nano::block_status::progress, node0.process (receive1)); ASSERT_EQ (node1.store.pending.begin (node1.store.tx_begin_read (), nano::pending_key{ key.pub, 0 }), node1.store.pending.end ()); // std::cerr << "node0: " << node0.network.endpoint () << std::endl; // std::cerr << "node1: " << node1.network.endpoint () << std::endl; diff --git a/nano/core_test/confirmation_height.cpp b/nano/core_test/confirmation_height.cpp index c832b3f2d1..906c6bc2d2 100644 --- a/nano/core_test/confirmation_height.cpp +++ b/nano/core_test/confirmation_height.cpp @@ -50,7 +50,7 @@ TEST (confirmation_height, single) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest1)) - .build_shared (); + .build (); // Check confirmation heights before, should be uninitialized (1 for genesis). nano::confirmation_height_info confirmation_height_info; @@ -199,20 +199,20 @@ TEST (confirmation_height, multiple_accounts) { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send3)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send3)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open3)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open3)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send4)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send5)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send4)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send5)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send6)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send6)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive2)); // Check confirmation heights of all the accounts (except genesis) are uninitialized (0), // as we have any just added them to the ledger and not processed any live transactions yet. @@ -238,7 +238,7 @@ TEST (confirmation_height, multiple_accounts) .source (send6->hash ()) .sign (key3.prv, key3.pub) .work (*system.work.generate (open3->hash ())) - .build_shared (); + .build (); node->process_active (receive3); auto election = nano::test::start_election (system, *node, receive3->hash ()); ASSERT_NE (nullptr, election); @@ -326,7 +326,7 @@ TEST (confirmation_height, gap_bootstrap) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); auto send2 = builder .state () @@ -337,7 +337,7 @@ TEST (confirmation_height, gap_bootstrap) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send2); auto send3 = builder .state () @@ -348,7 +348,7 @@ TEST (confirmation_height, gap_bootstrap) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send3); auto open1 = builder .open () @@ -357,7 +357,7 @@ TEST (confirmation_height, gap_bootstrap) .account (destination.pub) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*open1); // Receive @@ -367,7 +367,7 @@ TEST (confirmation_height, gap_bootstrap) .source (send2->hash ()) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*receive1); auto receive2 = builder .receive () @@ -375,7 +375,7 @@ TEST (confirmation_height, gap_bootstrap) .source (send3->hash ()) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*receive2); node1.block_processor.add (send1); @@ -459,7 +459,7 @@ TEST (confirmation_height, gap_live) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node->work_generate_blocking (*send1); auto send2 = builder .state () @@ -470,7 +470,7 @@ TEST (confirmation_height, gap_live) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node->work_generate_blocking (*send2); auto send3 = builder .state () @@ -481,7 +481,7 @@ TEST (confirmation_height, gap_live) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node->work_generate_blocking (*send3); auto open1 = builder @@ -491,7 +491,7 @@ TEST (confirmation_height, gap_live) .account (destination.pub) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node->work_generate_blocking (*open1); auto receive1 = builder .receive () @@ -499,7 +499,7 @@ TEST (confirmation_height, gap_live) .source (send2->hash ()) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node->work_generate_blocking (*receive1); auto receive2 = builder .receive () @@ -507,7 +507,7 @@ TEST (confirmation_height, gap_live) .source (send3->hash ()) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node->work_generate_blocking (*receive2); node->block_processor.add (send1); @@ -656,7 +656,7 @@ TEST (confirmation_height, send_receive_between_2_accounts) .source (send5->hash ()) .sign (key1.prv, key1.pub) .work (*system.work.generate (send4->hash ())) - .build_shared (); + .build (); nano::keypair key2; auto send6 = builder .send () @@ -669,20 +669,20 @@ TEST (confirmation_height, send_receive_between_2_accounts) // Unpocketed send { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send3)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send4)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send3)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send4)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive3)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive3)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send5)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send6)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send5)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send6)); } add_callback_stats (*node); @@ -749,7 +749,7 @@ TEST (confirmation_height, send_receive_self) .source (send1->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); auto send2 = builder .send () .previous (receive1->hash ()) @@ -779,7 +779,7 @@ TEST (confirmation_height, send_receive_self) .source (send3->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (receive2->hash ())) - .build_shared (); + .build (); // Send to another account to prevent automatic receiving on the genesis account nano::keypair key1; @@ -793,14 +793,14 @@ TEST (confirmation_height, send_receive_self) .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send3)); - - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive3)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send4)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send3)); + + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive3)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send4)); } add_callback_stats (*node); @@ -988,7 +988,7 @@ TEST (confirmation_height, all_block_types) .link (key1.pub) .sign (key2.prv, key2.pub) .work (*system.work.generate (state_receive2->hash ())) - .build_shared (); + .build (); auto state_send3 = builder .state () .account (key2.pub) @@ -1023,30 +1023,30 @@ TEST (confirmation_height, all_block_types) { auto transaction (store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *state_open)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, state_open)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *state_receive)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, state_receive)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *state_send)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *change)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *state_change)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, state_send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, change)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, state_change)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *epoch)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *epoch1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, epoch)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, epoch1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *state_send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *state_receive2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, state_send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, state_receive2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *state_send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *state_send3)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, state_send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, state_send3)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *state_send4)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *state_receive3)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, state_send4)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, state_receive3)); } add_callback_stats (*node); @@ -1116,8 +1116,8 @@ TEST (confirmation_height, conflict_rollback_cemented) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (genesis_hash)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*fork1a)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (fork1a)); ASSERT_TRUE (nano::test::start_elections (system, *node1, { fork1a }, true)); ASSERT_TIMELY (5s, nano::test::confirmed (*node1, { fork1a })); @@ -1131,7 +1131,7 @@ TEST (confirmation_height, conflict_rollback_cemented) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (genesis_hash)) - .build_shared (); + .build (); node1->block_processor.force (fork1b); // node2 already has send2 forced confirmed whilst node1 should have confirmed send1 and therefore we have a cemented fork on node2 @@ -1175,7 +1175,7 @@ TEST (confirmation_heightDeathTest, rollback_added_block) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); { auto transaction (store->tx_begin_write ()); store->initialize (transaction, ledger.cache, ledger.constants); @@ -1215,7 +1215,7 @@ TEST (confirmation_height, observers) .balance (amount - node1->config.receive_minimum.number ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest1)) - .build_shared (); + .build (); add_callback_stats (*node1); @@ -1265,11 +1265,11 @@ TEST (confirmation_heightDeathTest, modified_chain) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); { auto transaction (store->tx_begin_write ()); store->initialize (transaction, ledger.cache, ledger.constants); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); } uint64_t batch_write_size = 2048; @@ -1290,7 +1290,7 @@ TEST (confirmation_heightDeathTest, modified_chain) ASSERT_DEATH_IF_SUPPORTED (bounded_processor.cement_blocks (scoped_write_guard), ""); } - ASSERT_EQ (nano::block_status::progress, ledger.process (store->tx_begin_write (), *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (store->tx_begin_write (), send)); store->confirmation_height.put (store->tx_begin_write (), nano::dev::genesis->account (), { 1, nano::dev::genesis->hash () }); nano::confirmation_height_unbounded unbounded_processor ( @@ -1342,7 +1342,7 @@ TEST (confirmation_heightDeathTest, modified_chain_account_removed) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto open = builder .state () .account (key1.pub) @@ -1352,12 +1352,12 @@ TEST (confirmation_heightDeathTest, modified_chain_account_removed) .link (send->hash ()) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) - .build_shared (); + .build (); { auto transaction (store->tx_begin_write ()); store->initialize (transaction, ledger.cache, ledger.constants); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); } uint64_t batch_write_size = 2048; @@ -1379,7 +1379,7 @@ TEST (confirmation_heightDeathTest, modified_chain_account_removed) } // Reset conditions and test with the bounded processor - ASSERT_EQ (nano::block_status::progress, ledger.process (store->tx_begin_write (), *open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (store->tx_begin_write (), open)); store->confirmation_height.put (store->tx_begin_write (), nano::dev::genesis->account (), { 1, nano::dev::genesis->hash () }); nano::confirmation_height_bounded bounded_processor ( @@ -1430,12 +1430,12 @@ TEST (confirmation_height, pending_observer_callbacks) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio * 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send->hash ())) - .build_shared (); + .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); } add_callback_stats (*node); @@ -1479,10 +1479,10 @@ TEST (confirmation_height, callback_confirmed_history) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); } auto send1 = builder @@ -1492,7 +1492,7 @@ TEST (confirmation_height, callback_confirmed_history) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio * 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send->hash ())) - .build_shared (); + .build (); add_callback_stats (*node); @@ -1567,7 +1567,7 @@ TEST (confirmation_height, dependent_election) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto send1 = builder .send () .previous (send->hash ()) @@ -1575,7 +1575,7 @@ TEST (confirmation_height, dependent_election) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio * 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send->hash ())) - .build_shared (); + .build (); auto send2 = builder .send () .previous (send1->hash ()) @@ -1583,12 +1583,12 @@ TEST (confirmation_height, dependent_election) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio * 3) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send2)); } add_callback_stats (*node); @@ -1725,25 +1725,25 @@ TEST (confirmation_height, cemented_gap_below_receive) .account (key2.pub) .sign (key2.prv, key2.pub) .work (*system.work.generate (key2.pub)) - .build_shared (); + .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *dummy_send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, dummy_send)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *dummy_send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, dummy_send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send3)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *dummy_send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send3)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, dummy_send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open1)); } std::vector observer_order; @@ -1885,25 +1885,25 @@ TEST (confirmation_height, cemented_gap_below_no_cache) .account (key2.pub) .sign (key2.prv, key2.pub) .work (*system.work.generate (key2.pub)) - .build_shared (); + .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *dummy_send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, dummy_send)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *dummy_send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, dummy_send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send3)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *dummy_send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send3)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, dummy_send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open1)); } // Force some blocks to be cemented so that the cached confirmed info variable is empty @@ -1958,8 +1958,8 @@ TEST (confirmation_height, election_winner_details_clearing) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node->process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node->process (send1)); auto const send2 = builder.make_block () .previous (send1->hash ()) @@ -1967,8 +1967,8 @@ TEST (confirmation_height, election_winner_details_clearing) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio * 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node->process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node->process (send2)); auto const send3 = builder.make_block () .previous (send2->hash ()) @@ -1976,8 +1976,8 @@ TEST (confirmation_height, election_winner_details_clearing) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio * 3) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send2->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node->process (*send3)); + .build (); + ASSERT_EQ (nano::block_status::progress, node->process (send3)); node->process_confirmed (nano::election_status{ send2 }); ASSERT_TIMELY (5s, node->block_confirmed (send2->hash ())); @@ -2016,7 +2016,7 @@ TEST (confirmation_height, election_winner_details_clearing_node_process_confirm .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // Add to election_winner_details. Use an unrealistic iteration so that it should fall into the else case and do a cleanup node->active.add_election_winner_details (send->hash (), nullptr); nano::election_status election; @@ -2050,7 +2050,7 @@ TEST (confirmation_height, unbounded_block_cache_iteration) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send1 = builder .send () .previous (send->hash ()) @@ -2058,12 +2058,12 @@ TEST (confirmation_height, unbounded_block_cache_iteration) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio * 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send->hash ())) - .build_shared (); + .build (); { auto transaction (store->tx_begin_write ()); store->initialize (transaction, ledger.cache, nano::dev::constants); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); } nano::confirmation_height_processor confirmation_height_processor (ledger, write_database_queue, 10ms, logger, initialized_latch, nano::confirmation_height_mode::unbounded); @@ -2115,7 +2115,7 @@ TEST (confirmation_height, pruned_source) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto open1 = builder .state () .account (key1.pub) @@ -2125,7 +2125,7 @@ TEST (confirmation_height, pruned_source) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) - .build_shared (); + .build (); auto send2 = builder .state () .account (key1.pub) @@ -2135,7 +2135,7 @@ TEST (confirmation_height, pruned_source) .link (key2.pub) .sign (key1.prv, key1.pub) .work (*pool.generate (open1->hash ())) - .build_shared (); + .build (); auto send3 = builder .state () .account (key1.pub) @@ -2145,7 +2145,7 @@ TEST (confirmation_height, pruned_source) .link (key2.pub) .sign (key1.prv, key1.pub) .work (*pool.generate (send2->hash ())) - .build_shared (); + .build (); auto open2 = builder .state () .account (key2.pub) @@ -2155,15 +2155,15 @@ TEST (confirmation_height, pruned_source) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*pool.generate (key2.pub)) - .build_shared (); + .build (); { auto transaction (store->tx_begin_write ()); store->initialize (transaction, ledger.cache, nano::dev::constants); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send3)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open2)); } uint64_t batch_write_size = 2; std::atomic stopped{ false }; diff --git a/nano/core_test/confirmation_solicitor.cpp b/nano/core_test/confirmation_solicitor.cpp index c456624153..c47ae54e88 100644 --- a/nano/core_test/confirmation_solicitor.cpp +++ b/nano/core_test/confirmation_solicitor.cpp @@ -37,7 +37,7 @@ TEST (confirmation_solicitor, batches) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); send->sideband_set ({}); { nano::lock_guard guard (node2.active.mutex); @@ -87,7 +87,7 @@ TEST (confirmation_solicitor, different_hash) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); send->sideband_set ({}); auto election (std::make_shared (node2, send, nullptr, nullptr, nano::election_behavior::normal)); // Add a vote for something else, not the winner @@ -131,7 +131,7 @@ TEST (confirmation_solicitor, bypass_max_requests_cap) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); send->sideband_set ({}); auto election (std::make_shared (node2, send, nullptr, nullptr, nano::election_behavior::normal)); // Add a vote for something else, not the winner diff --git a/nano/core_test/conflicts.cpp b/nano/core_test/conflicts.cpp index 8ee21c4dba..644388bdba 100644 --- a/nano/core_test/conflicts.cpp +++ b/nano/core_test/conflicts.cpp @@ -25,9 +25,9 @@ TEST (conflicts, start_stop) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); - ASSERT_EQ (nano::block_status::progress, node1.process (*send1)); + ASSERT_EQ (nano::block_status::progress, node1.process (send1)); ASSERT_EQ (0, node1.active.size ()); node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.store.tx_begin_read ()); ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ())); @@ -52,11 +52,11 @@ TEST (conflicts, add_existing) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); // add the block to ledger as an unconfirmed block - ASSERT_EQ (nano::block_status::progress, node1.process (*send1)); + ASSERT_EQ (nano::block_status::progress, node1.process (send1)); // wait for send1 to be inserted in the ledger ASSERT_TIMELY (5s, node1.block (send1->hash ())); @@ -75,7 +75,7 @@ TEST (conflicts, add_existing) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send2); send2->sideband_set ({}); @@ -108,7 +108,7 @@ TEST (conflicts, add_two) .link (key3.pub) .sign (key1.prv, key1.pub) .work (*system.work.generate (open1->hash ())) - .build_shared (); + .build (); // send 1 raw to account key3 from key2 auto send_b = nano::state_block_builder () @@ -119,7 +119,7 @@ TEST (conflicts, add_two) .link (key3.pub) .sign (key2.prv, key2.pub) .work (*system.work.generate (open2->hash ())) - .build_shared (); + .build (); // activate elections for the previous two send blocks (to account3) that we did not forcefully confirm ASSERT_TRUE (nano::test::process (*node, { send_a, send_b })); @@ -149,7 +149,7 @@ TEST (vote_uniquer, vbh_one) .link (0) .sign (key.prv, key.pub) .work (0) - .build_shared (); + .build (); std::vector hashes; hashes.push_back (block->hash ()); auto vote1 = nano::test::make_vote (key, { hashes }, 0, 0); @@ -172,7 +172,7 @@ TEST (vote_uniquer, vbh_two) .link (0) .sign (key.prv, key.pub) .work (0) - .build_shared (); + .build (); std::vector hashes1; hashes1.push_back (block1->hash ()); auto block2 = builder @@ -184,7 +184,7 @@ TEST (vote_uniquer, vbh_two) .link (0) .sign (key.prv, key.pub) .work (0) - .build_shared (); + .build (); std::vector hashes2; hashes2.push_back (block2->hash ()); auto vote1 = nano::test::make_vote (key, { hashes1 }, 0, 0); diff --git a/nano/core_test/election.cpp b/nano/core_test/election.cpp index 52ffa5e8d2..fc193cc659 100644 --- a/nano/core_test/election.cpp +++ b/nano/core_test/election.cpp @@ -47,7 +47,7 @@ TEST (election, quorum_minimum_flip_success) .link (key1.pub) .work (*system.work.generate (latest_hash)) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .build_shared (); + .build (); nano::keypair key2{}; auto send2 = builder.make_block () @@ -58,7 +58,7 @@ TEST (election, quorum_minimum_flip_success) .link (key2.pub) .work (*system.work.generate (latest_hash)) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .build_shared (); + .build (); node1.process_active (send1); ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ()) != nullptr) @@ -94,7 +94,7 @@ TEST (election, quorum_minimum_flip_fail) .link (nano::keypair{}.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .build_shared (); + .build (); auto send2 = builder.make_block () .previous (nano::dev::genesis->hash ()) @@ -104,7 +104,7 @@ TEST (election, quorum_minimum_flip_fail) .link (nano::keypair{}.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .build_shared (); + .build (); // process send1 and wait until its election appears node.process_active (send1); @@ -145,7 +145,7 @@ TEST (election, quorum_minimum_confirm_success) .link (key1.pub) .work (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); node1.process_active (send1); node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.store.tx_begin_read ()); @@ -177,7 +177,7 @@ TEST (election, quorum_minimum_confirm_fail) .link (nano::keypair{}.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .build_shared (); + .build (); node1.process_active (send1); auto election = nano::test::start_election (system, node1, send1->hash ()); @@ -219,12 +219,12 @@ TEST (election, quorum_minimum_update_weight_before_quorum_checks) .balance (amount) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); node1.process_active (send1); ASSERT_TIMELY (5s, node1.block (send1->hash ()) != nullptr); - auto const open1 = nano::open_block_builder{}.make_block ().account (key1.pub).source (send1->hash ()).representative (key1.pub).sign (key1.prv, key1.pub).work (*system.work.generate (key1.pub)).build_shared (); - ASSERT_EQ (nano::block_status::progress, node1.process (*open1)); + auto const open1 = nano::open_block_builder{}.make_block ().account (key1.pub).source (send1->hash ()).representative (key1.pub).sign (key1.prv, key1.pub).work (*system.work.generate (key1.pub)).build (); + ASSERT_EQ (nano::block_status::progress, node1.process (open1)); nano::keypair key2; auto const send2 = builder.make_block () @@ -233,8 +233,8 @@ TEST (election, quorum_minimum_update_weight_before_quorum_checks) .balance (3) .sign (key1.prv, key1.pub) .work (*system.work.generate (open1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1.process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1.process (send2)); ASSERT_TIMELY_EQ (5s, node1.ledger.cache.block_count, 4); node_config.peering_port = system.get_available_port (); @@ -283,7 +283,7 @@ TEST (election, continuous_voting) .balance (node1.balance (nano::dev::genesis_key.pub) / 10 * 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); ASSERT_TRUE (nano::test::process (node1, { send1 })); ASSERT_TRUE (nano::test::start_elections (system, node1, { send1 }, true)); @@ -298,7 +298,7 @@ TEST (election, continuous_voting) .balance (node1.balance (nano::dev::genesis_key.pub) - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); ASSERT_TRUE (nano::test::process (node1, { send2 })); ASSERT_TIMELY (5s, node1.active.active (*send2)); diff --git a/nano/core_test/election_scheduler.cpp b/nano/core_test/election_scheduler.cpp index b13c3af776..af028dd996 100644 --- a/nano/core_test/election_scheduler.cpp +++ b/nano/core_test/election_scheduler.cpp @@ -26,8 +26,8 @@ TEST (election_scheduler, activate_one_timely) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - system.nodes[0]->ledger.process (system.nodes[0]->store.tx_begin_write (), *send1); + .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 ())); } @@ -44,8 +44,8 @@ TEST (election_scheduler, activate_one_flush) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - system.nodes[0]->ledger.process (system.nodes[0]->store.tx_begin_write (), *send1); + .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 ())); } @@ -86,8 +86,8 @@ TEST (election_scheduler, no_vacancy) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*send)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (send)); node.process_confirmed (nano::election_status{ send }); auto receive = builder.make_block () @@ -98,8 +98,8 @@ TEST (election_scheduler, no_vacancy) .balance (nano::Gxrb_ratio) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*receive)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (receive)); node.process_confirmed (nano::election_status{ receive }); // Second, process two eligible transactions @@ -111,8 +111,8 @@ TEST (election_scheduler, no_vacancy) .balance (nano::dev::constants.genesis_amount - 2 * nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*block1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (block1)); // There is vacancy so it should be inserted node.scheduler.priority.activate (nano::dev::genesis_key.pub, node.store.tx_begin_read ()); @@ -127,8 +127,8 @@ TEST (election_scheduler, no_vacancy) .balance (0) .sign (key.prv, key.pub) .work (*system.work.generate (receive->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*block2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (block2)); // There is no vacancy so it should stay queued node.scheduler.priority.activate (key.pub, node.store.tx_begin_read ()); diff --git a/nano/core_test/frontiers_confirmation.cpp b/nano/core_test/frontiers_confirmation.cpp index 3b5c29f376..76812a6bc7 100644 --- a/nano/core_test/frontiers_confirmation.cpp +++ b/nano/core_test/frontiers_confirmation.cpp @@ -29,7 +29,7 @@ TEST (frontiers_confirmation, mode) .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); } ASSERT_TIMELY_EQ (5s, node->active.size (), 1); } @@ -51,7 +51,7 @@ TEST (frontiers_confirmation, mode) .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); } ASSERT_TIMELY_EQ (5s, node->active.size (), 1); } @@ -73,7 +73,7 @@ TEST (frontiers_confirmation, mode) .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); } system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); std::this_thread::sleep_for (std::chrono::seconds (1)); diff --git a/nano/core_test/ledger.cpp b/nano/core_test/ledger.cpp index fd52883a67..821d1d4994 100644 --- a/nano/core_test/ledger.cpp +++ b/nano/core_test/ledger.cpp @@ -77,7 +77,7 @@ TEST (ledger, process_modifies_sideband) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (store.tx_begin_write (), *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (store.tx_begin_write (), send1)); ASSERT_EQ (send1->sideband ().timestamp, store.block.get (store.tx_begin_read (), send1->hash ())->sideband ().timestamp); } @@ -105,7 +105,7 @@ TEST (ledger, process_send) ASSERT_EQ (nano::dev::genesis_key.pub, store.frontier.get (transaction, info1->head)); ASSERT_EQ (1, info1->block_count); // This was a valid block, it should progress. - auto return1 = ledger.process (transaction, *send); + auto return1 = ledger.process (transaction, send); ASSERT_EQ (nano::dev::genesis_key.pub, send->sideband ().account); ASSERT_EQ (2, send->sideband ().height); ASSERT_EQ (nano::dev::constants.genesis_amount - 50, ledger.amount (transaction, hash1)); @@ -134,7 +134,7 @@ TEST (ledger, process_send) .build (); nano::block_hash hash2 (open->hash ()); // This was a valid block, it should progress. - auto return2 = ledger.process (transaction, *open); + auto return2 = ledger.process (transaction, open); ASSERT_EQ (nano::block_status::progress, return2); ASSERT_EQ (key2.pub, open->sideband ().account); ASSERT_EQ (nano::dev::constants.genesis_amount - 50, open->sideband ().balance.number ()); @@ -212,7 +212,7 @@ TEST (ledger, process_receive) .work (*pool.generate (info1->head)) .build (); nano::block_hash hash1 (send->hash ()); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); nano::keypair key3; auto open = builder .open () @@ -223,7 +223,7 @@ TEST (ledger, process_receive) .work (*pool.generate (key2.pub)) .build (); nano::block_hash hash2 (open->hash ()); - auto return1 = ledger.process (transaction, *open); + auto return1 = ledger.process (transaction, open); ASSERT_EQ (nano::block_status::progress, return1); ASSERT_EQ (key2.pub, ledger.account (*open)); ASSERT_EQ (key2.pub, open->sideband ().account); @@ -240,7 +240,7 @@ TEST (ledger, process_receive) .work (*pool.generate (hash1)) .build (); nano::block_hash hash3 = send2->hash (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); auto receive = builder .receive () .previous (hash2) @@ -250,7 +250,7 @@ TEST (ledger, process_receive) .build (); auto hash4 = receive->hash (); ASSERT_EQ (key2.pub, store.frontier.get (transaction, hash2)); - auto return2 = ledger.process (transaction, *receive); + auto return2 = ledger.process (transaction, receive); ASSERT_EQ (key2.pub, receive->sideband ().account); ASSERT_EQ (nano::dev::constants.genesis_amount - 25, receive->sideband ().balance.number ()); ASSERT_EQ (2, receive->sideband ().height); @@ -300,7 +300,7 @@ TEST (ledger, rollback_receiver) .work (*pool.generate (info1->head)) .build (); nano::block_hash hash1 (send->hash ()); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); nano::keypair key3; auto open = builder .open () @@ -311,7 +311,7 @@ TEST (ledger, rollback_receiver) .work (*pool.generate (key2.pub)) .build (); nano::block_hash hash2 (open->hash ()); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); ASSERT_EQ (hash2, ledger.latest (transaction, key2.pub)); ASSERT_EQ (50, ledger.account_balance (transaction, nano::dev::genesis_key.pub)); ASSERT_EQ (nano::dev::constants.genesis_amount - 50, ledger.account_balance (transaction, key2.pub)); @@ -345,7 +345,7 @@ TEST (ledger, rollback_representation) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *change1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change1)); nano::keypair key3; auto change2 = builder .change () @@ -354,7 +354,7 @@ TEST (ledger, rollback_representation) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (change1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *change2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change2)); nano::keypair key2; auto send1 = builder .send () @@ -364,7 +364,7 @@ TEST (ledger, rollback_representation) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (change2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); nano::keypair key4; auto open = builder .open () @@ -374,7 +374,7 @@ TEST (ledger, rollback_representation) .sign (key2.prv, key2.pub) .work (*pool.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); auto send2 = builder .send () .previous (send1->hash ()) @@ -383,7 +383,7 @@ TEST (ledger, rollback_representation) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); auto receive1 = builder .receive () .previous (open->hash ()) @@ -391,7 +391,7 @@ TEST (ledger, rollback_representation) .sign (key2.prv, key2.pub) .work (*pool.generate (open->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_EQ (1, ledger.weight (key3.pub)); ASSERT_EQ (nano::dev::constants.genesis_amount - 1, ledger.weight (key4.pub)); auto info1 = ledger.account_info (transaction, key2.pub); @@ -435,7 +435,7 @@ TEST (ledger, receive_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); auto receive = builder .receive () .previous (send->hash ()) @@ -443,7 +443,7 @@ TEST (ledger, receive_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive)); ASSERT_FALSE (ledger.rollback (transaction, receive->hash ())); } @@ -467,8 +467,8 @@ TEST (ledger, process_duplicate) .work (*pool.generate (info1->head)) .build (); nano::block_hash hash1 (send->hash ()); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); - ASSERT_EQ (nano::block_status::old, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); + ASSERT_EQ (nano::block_status::old, ledger.process (transaction, send)); auto open = builder .open () .source (hash1) @@ -477,8 +477,8 @@ TEST (ledger, process_duplicate) .sign (key2.prv, key2.pub) .work (*pool.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open)); - ASSERT_EQ (nano::block_status::old, ledger.process (transaction, *open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); + ASSERT_EQ (nano::block_status::old, ledger.process (transaction, open)); } TEST (ledger, representative_genesis) @@ -520,7 +520,7 @@ TEST (ledger, representative_change) .work (*pool.generate (info1->head)) .build (); ASSERT_EQ (nano::dev::genesis_key.pub, store.frontier.get (transaction, info1->head)); - auto return1 (ledger.process (transaction, *block)); + auto return1 (ledger.process (transaction, block)); ASSERT_EQ (0, ledger.amount (transaction, block->hash ())); ASSERT_TRUE (store.frontier.get (transaction, info1->head).is_zero ()); ASSERT_EQ (nano::dev::genesis_key.pub, store.frontier.get (transaction, block->hash ())); @@ -561,7 +561,7 @@ TEST (ledger, send_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (info1->head)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block)); auto block2 = builder .send () .previous (info1->head) @@ -570,7 +570,7 @@ TEST (ledger, send_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (info1->head)) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, block2)); } TEST (ledger, receive_fork) @@ -593,7 +593,7 @@ TEST (ledger, receive_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (info1->head)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block)); auto block2 = builder .open () .source (block->hash ()) @@ -602,7 +602,7 @@ TEST (ledger, receive_fork) .sign (key2.prv, key2.pub) .work (*pool.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block2)); auto block3 = builder .change () .previous (block2->hash ()) @@ -610,7 +610,7 @@ TEST (ledger, receive_fork) .sign (key2.prv, key2.pub) .work (*pool.generate (block2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block3)); auto block4 = builder .send () .previous (block->hash ()) @@ -619,7 +619,7 @@ TEST (ledger, receive_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block4)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block4)); auto block5 = builder .receive () .previous (block2->hash ()) @@ -627,7 +627,7 @@ TEST (ledger, receive_fork) .sign (key2.prv, key2.pub) .work (*pool.generate (block2->hash ())) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *block5)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, block5)); } TEST (ledger, open_fork) @@ -650,7 +650,7 @@ TEST (ledger, open_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (info1->head)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block)); auto block2 = builder .open () .source (block->hash ()) @@ -659,7 +659,7 @@ TEST (ledger, open_fork) .sign (key2.prv, key2.pub) .work (*pool.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block2)); auto block3 = builder .open () .source (block->hash ()) @@ -668,7 +668,7 @@ TEST (ledger, open_fork) .sign (key2.prv, key2.pub) .work (*pool.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *block3)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, block3)); } TEST (ledger, representation_changes) @@ -701,7 +701,7 @@ TEST (ledger, representation) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block1)); ASSERT_EQ (nano::dev::constants.genesis_amount - 100, rep_weights.representation_get (nano::dev::genesis_key.pub)); nano::keypair key3; auto block2 = builder @@ -712,7 +712,7 @@ TEST (ledger, representation) .sign (key2.prv, key2.pub) .work (*pool.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block2)); ASSERT_EQ (nano::dev::constants.genesis_amount - 100, rep_weights.representation_get (nano::dev::genesis_key.pub)); ASSERT_EQ (0, rep_weights.representation_get (key2.pub)); ASSERT_EQ (100, rep_weights.representation_get (key3.pub)); @@ -724,7 +724,7 @@ TEST (ledger, representation) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block3)); ASSERT_EQ (nano::dev::constants.genesis_amount - 200, rep_weights.representation_get (nano::dev::genesis_key.pub)); ASSERT_EQ (0, rep_weights.representation_get (key2.pub)); ASSERT_EQ (100, rep_weights.representation_get (key3.pub)); @@ -735,7 +735,7 @@ TEST (ledger, representation) .sign (key2.prv, key2.pub) .work (*pool.generate (block2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block4)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block4)); ASSERT_EQ (nano::dev::constants.genesis_amount - 200, rep_weights.representation_get (nano::dev::genesis_key.pub)); ASSERT_EQ (0, rep_weights.representation_get (key2.pub)); ASSERT_EQ (200, rep_weights.representation_get (key3.pub)); @@ -747,7 +747,7 @@ TEST (ledger, representation) .sign (key2.prv, key2.pub) .work (*pool.generate (block4->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block5)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block5)); ASSERT_EQ (nano::dev::constants.genesis_amount - 200, rep_weights.representation_get (nano::dev::genesis_key.pub)); ASSERT_EQ (0, rep_weights.representation_get (key2.pub)); ASSERT_EQ (0, rep_weights.representation_get (key3.pub)); @@ -761,7 +761,7 @@ TEST (ledger, representation) .sign (key2.prv, key2.pub) .work (*pool.generate (block5->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block6)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block6)); ASSERT_EQ (nano::dev::constants.genesis_amount - 200, rep_weights.representation_get (nano::dev::genesis_key.pub)); ASSERT_EQ (0, rep_weights.representation_get (key2.pub)); ASSERT_EQ (0, rep_weights.representation_get (key3.pub)); @@ -776,7 +776,7 @@ TEST (ledger, representation) .sign (key5.prv, key5.pub) .work (*pool.generate (key5.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block7)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block7)); ASSERT_EQ (nano::dev::constants.genesis_amount - 200, rep_weights.representation_get (nano::dev::genesis_key.pub)); ASSERT_EQ (0, rep_weights.representation_get (key2.pub)); ASSERT_EQ (0, rep_weights.representation_get (key3.pub)); @@ -791,7 +791,7 @@ TEST (ledger, representation) .sign (key2.prv, key2.pub) .work (*pool.generate (block6->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block8)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block8)); ASSERT_EQ (nano::dev::constants.genesis_amount - 200, rep_weights.representation_get (nano::dev::genesis_key.pub)); ASSERT_EQ (0, rep_weights.representation_get (key2.pub)); ASSERT_EQ (0, rep_weights.representation_get (key3.pub)); @@ -805,7 +805,7 @@ TEST (ledger, representation) .sign (key5.prv, key5.pub) .work (*pool.generate (block7->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block9)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block9)); ASSERT_EQ (nano::dev::constants.genesis_amount - 200, rep_weights.representation_get (nano::dev::genesis_key.pub)); ASSERT_EQ (0, rep_weights.representation_get (key2.pub)); ASSERT_EQ (0, rep_weights.representation_get (key3.pub)); @@ -834,7 +834,7 @@ TEST (ledger, double_open) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto open1 = builder .open () .source (send1->hash ()) @@ -843,7 +843,7 @@ TEST (ledger, double_open) .sign (key2.prv, key2.pub) .work (*pool.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); auto open2 = builder .open () .source (send1->hash ()) @@ -852,7 +852,7 @@ TEST (ledger, double_open) .sign (key2.prv, key2.pub) .work (*pool.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *open2)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, open2)); } TEST (ledger, double_receive) @@ -872,7 +872,7 @@ TEST (ledger, double_receive) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto open1 = builder .open () .source (send1->hash ()) @@ -881,7 +881,7 @@ TEST (ledger, double_receive) .sign (key2.prv, key2.pub) .work (*pool.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); auto receive1 = builder .receive () .previous (open1->hash ()) @@ -889,7 +889,7 @@ TEST (ledger, double_receive) .sign (key2.prv, key2.pub) .work (*pool.generate (open1->hash ())) .build (); - ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, receive1)); } TEST (votes, check_signature) @@ -907,11 +907,11 @@ TEST (votes, check_signature) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); { auto transaction (node1.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, send1)); } node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.store.tx_begin_read ()); ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ())); @@ -938,10 +938,10 @@ TEST (votes, add_one) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); auto transaction (node1.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, send1)); node1.start_election (send1); ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ())); auto election1 = node1.active.election (send1->qualified_root ()); @@ -983,7 +983,7 @@ TEST (votes, add_existing) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .build (); node1.work_generate_blocking (*send1); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (node1.store.tx_begin_write (), *send1)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (node1.store.tx_begin_write (), send1)); node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.store.tx_begin_read ()); ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ())); auto election1 = node1.active.election (send1->qualified_root ()); @@ -1039,10 +1039,10 @@ TEST (votes, add_old) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); auto transaction (node1.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, send1)); node1.start_election (send1); ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ())); auto election1 = node1.active.election (send1->qualified_root ()); @@ -1057,7 +1057,7 @@ TEST (votes, add_old) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send2); auto vote2 = std::make_shared (nano::dev::genesis_key.pub, nano::dev::genesis_key.prv, nano::vote::timestamp_min * 1, 0, std::vector{ send2->hash () }); auto vote_info = election1->get_last_vote (nano::dev::genesis_key.pub); @@ -1089,7 +1089,7 @@ TEST (votes, DISABLED_add_old_different_account) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); auto send2 = builder .send () @@ -1098,10 +1098,10 @@ TEST (votes, DISABLED_add_old_different_account) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send2); - ASSERT_EQ (nano::block_status::progress, node1.process (*send1)); - ASSERT_EQ (nano::block_status::progress, node1.process (*send2)); + ASSERT_EQ (nano::block_status::progress, node1.process (send1)); + ASSERT_EQ (nano::block_status::progress, node1.process (send2)); ASSERT_TRUE (nano::test::start_elections (system, node1, { send1, send2 })); auto election1 = node1.active.election (send1->qualified_root ()); ASSERT_NE (nullptr, election1); @@ -1144,10 +1144,10 @@ TEST (votes, add_cooldown) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); auto transaction (node1.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, send1)); node1.start_election (send1); ASSERT_TIMELY (5s, node1.active.election (send1->qualified_root ())); auto election1 = node1.active.election (send1->qualified_root ()); @@ -1162,7 +1162,7 @@ TEST (votes, add_cooldown) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send2); auto vote2 = nano::test::make_vote (nano::dev::genesis_key, { send2 }, nano::vote::timestamp_min * 2, 0); node1.vote_processor.vote_blocking (vote2, channel); @@ -1190,7 +1190,7 @@ TEST (ledger, successor) .build (); node1.work_generate_blocking (*send1); auto transaction (node1.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, send1)); ASSERT_EQ (*send1, *node1.ledger.successor (transaction, nano::qualified_root (nano::root (0), nano::dev::genesis->hash ()))); ASSERT_EQ (*nano::dev::genesis, *node1.ledger.successor (transaction, nano::dev::genesis->qualified_root ())); ASSERT_EQ (nullptr, node1.ledger.successor (transaction, nano::qualified_root (0))); @@ -1212,9 +1212,9 @@ TEST (ledger, fail_change_old) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block); + auto result1 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::progress, result1); - auto result2 = ledger.process (transaction, *block); + auto result2 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::old, result2); } @@ -1234,7 +1234,7 @@ TEST (ledger, fail_change_gap_previous) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::root (1))) .build (); - auto result1 = ledger.process (transaction, *block); + auto result1 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::gap_previous, result1); } @@ -1256,7 +1256,7 @@ TEST (ledger, fail_state_bad_signature) .sign (nano::keypair ().prv, 0) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block); + auto result1 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::bad_signature, result1); } @@ -1277,12 +1277,12 @@ TEST (ledger, fail_epoch_bad_signature) .link (ledger.epoch_link (nano::epoch::epoch_1)) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); block->signature.bytes[0] ^= 1; - auto result1 = ledger.process (transaction, *block); + auto result1 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::bad_signature, result1); // Fails epoch signature block->signature.bytes[0] ^= 1; - auto result2 = ledger.process (transaction, *block); + auto result2 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::progress, result2); // Succeeds with epoch signature } @@ -1302,7 +1302,7 @@ TEST (ledger, fail_change_bad_signature) .sign (nano::keypair ().prv, 0) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block); + auto result1 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::bad_signature, result1); } @@ -1322,7 +1322,7 @@ TEST (ledger, fail_change_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block1); + auto result1 = ledger.process (transaction, block1); ASSERT_EQ (nano::block_status::progress, result1); nano::keypair key2; auto block2 = builder @@ -1332,7 +1332,7 @@ TEST (ledger, fail_change_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result2 = ledger.process (transaction, *block2); + auto result2 = ledger.process (transaction, block2); ASSERT_EQ (nano::block_status::fork, result2); } @@ -1353,9 +1353,9 @@ TEST (ledger, fail_send_old) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block); + auto result1 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::progress, result1); - auto result2 = ledger.process (transaction, *block); + auto result2 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::old, result2); } @@ -1376,7 +1376,7 @@ TEST (ledger, fail_send_gap_previous) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::root (1))) .build (); - auto result1 = ledger.process (transaction, *block); + auto result1 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::gap_previous, result1); } @@ -1397,7 +1397,7 @@ TEST (ledger, fail_send_bad_signature) .sign (nano::keypair ().prv, 0) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block); + auto result1 = ledger.process (transaction, block); ASSERT_EQ (nano::block_status::bad_signature, result1); } @@ -1418,7 +1418,7 @@ TEST (ledger, fail_send_negative_spend) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block1)); nano::keypair key2; auto block2 = builder .send () @@ -1428,7 +1428,7 @@ TEST (ledger, fail_send_negative_spend) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block1->hash ())) .build (); - ASSERT_EQ (nano::block_status::negative_spend, ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::negative_spend, ledger.process (transaction, block2)); } TEST (ledger, fail_send_fork) @@ -1448,7 +1448,7 @@ TEST (ledger, fail_send_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block1)); nano::keypair key2; auto block2 = builder .send () @@ -1458,7 +1458,7 @@ TEST (ledger, fail_send_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, block2)); } TEST (ledger, fail_open_old) @@ -1478,7 +1478,7 @@ TEST (ledger, fail_open_old) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block1)); auto block2 = builder .open () .source (block1->hash ()) @@ -1487,8 +1487,8 @@ TEST (ledger, fail_open_old) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block2)); - ASSERT_EQ (nano::block_status::old, ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block2)); + ASSERT_EQ (nano::block_status::old, ledger.process (transaction, block2)); } TEST (ledger, fail_open_gap_source) @@ -1508,7 +1508,7 @@ TEST (ledger, fail_open_gap_source) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - auto result2 = ledger.process (transaction, *block2); + auto result2 = ledger.process (transaction, block2); ASSERT_EQ (nano::block_status::gap_source, result2); } @@ -1529,7 +1529,7 @@ TEST (ledger, fail_open_bad_signature) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block1)); auto block2 = builder .open () .source (block1->hash ()) @@ -1539,7 +1539,7 @@ TEST (ledger, fail_open_bad_signature) .work (*pool.generate (key1.pub)) .build (); block2->signature.clear (); - ASSERT_EQ (nano::block_status::bad_signature, ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::bad_signature, ledger.process (transaction, block2)); } TEST (ledger, fail_open_fork_previous) @@ -1559,7 +1559,7 @@ TEST (ledger, fail_open_fork_previous) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block1)); auto block2 = builder .send () .previous (block1->hash ()) @@ -1568,7 +1568,7 @@ TEST (ledger, fail_open_fork_previous) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block2)); auto block3 = builder .open () .source (block1->hash ()) @@ -1577,7 +1577,7 @@ TEST (ledger, fail_open_fork_previous) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block3)); auto block4 = builder .open () .source (block2->hash ()) @@ -1586,7 +1586,7 @@ TEST (ledger, fail_open_fork_previous) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *block4)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, block4)); ASSERT_EQ (store.account.count (transaction), ledger.cache.account_count); } @@ -1607,7 +1607,7 @@ TEST (ledger, fail_open_account_mismatch) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block1)); nano::keypair badkey; auto block2 = builder .open () @@ -1617,7 +1617,7 @@ TEST (ledger, fail_open_account_mismatch) .sign (badkey.prv, badkey.pub) .work (*pool.generate (badkey.pub)) .build (); - ASSERT_NE (nano::block_status::progress, ledger.process (transaction, *block2)); + ASSERT_NE (nano::block_status::progress, ledger.process (transaction, block2)); ASSERT_EQ (store.account.count (transaction), ledger.cache.account_count); } @@ -1638,7 +1638,7 @@ TEST (ledger, fail_receive_old) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block1)); auto block2 = builder .send () .previous (block1->hash ()) @@ -1647,7 +1647,7 @@ TEST (ledger, fail_receive_old) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block2)); auto block3 = builder .open () .source (block1->hash ()) @@ -1656,7 +1656,7 @@ TEST (ledger, fail_receive_old) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block3)); auto block4 = builder .receive () .previous (block3->hash ()) @@ -1664,8 +1664,8 @@ TEST (ledger, fail_receive_old) .sign (key1.prv, key1.pub) .work (*pool.generate (block3->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block4)); - ASSERT_EQ (nano::block_status::old, ledger.process (transaction, *block4)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block4)); + ASSERT_EQ (nano::block_status::old, ledger.process (transaction, block4)); } TEST (ledger, fail_receive_gap_source) @@ -1685,7 +1685,7 @@ TEST (ledger, fail_receive_gap_source) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block1); + auto result1 = ledger.process (transaction, block1); ASSERT_EQ (nano::block_status::progress, result1); auto block2 = builder .send () @@ -1695,7 +1695,7 @@ TEST (ledger, fail_receive_gap_source) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block1->hash ())) .build (); - auto result2 = ledger.process (transaction, *block2); + auto result2 = ledger.process (transaction, block2); ASSERT_EQ (nano::block_status::progress, result2); auto block3 = builder .open () @@ -1705,7 +1705,7 @@ TEST (ledger, fail_receive_gap_source) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - auto result3 = ledger.process (transaction, *block3); + auto result3 = ledger.process (transaction, block3); ASSERT_EQ (nano::block_status::progress, result3); auto block4 = builder .receive () @@ -1714,7 +1714,7 @@ TEST (ledger, fail_receive_gap_source) .sign (key1.prv, key1.pub) .work (*pool.generate (block3->hash ())) .build (); - auto result4 = ledger.process (transaction, *block4); + auto result4 = ledger.process (transaction, block4); ASSERT_EQ (nano::block_status::gap_source, result4); } @@ -1735,7 +1735,7 @@ TEST (ledger, fail_receive_overreceive) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block1); + auto result1 = ledger.process (transaction, block1); ASSERT_EQ (nano::block_status::progress, result1); auto block2 = builder .open () @@ -1745,7 +1745,7 @@ TEST (ledger, fail_receive_overreceive) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - auto result3 = ledger.process (transaction, *block2); + auto result3 = ledger.process (transaction, block2); ASSERT_EQ (nano::block_status::progress, result3); auto block3 = builder .receive () @@ -1754,7 +1754,7 @@ TEST (ledger, fail_receive_overreceive) .sign (key1.prv, key1.pub) .work (*pool.generate (block2->hash ())) .build (); - auto result4 = ledger.process (transaction, *block3); + auto result4 = ledger.process (transaction, block3); ASSERT_EQ (nano::block_status::unreceivable, result4); } @@ -1775,7 +1775,7 @@ TEST (ledger, fail_receive_bad_signature) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block1); + auto result1 = ledger.process (transaction, block1); ASSERT_EQ (nano::block_status::progress, result1); auto block2 = builder .send () @@ -1785,7 +1785,7 @@ TEST (ledger, fail_receive_bad_signature) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block1->hash ())) .build (); - auto result2 = ledger.process (transaction, *block2); + auto result2 = ledger.process (transaction, block2); ASSERT_EQ (nano::block_status::progress, result2); auto block3 = builder .open () @@ -1795,7 +1795,7 @@ TEST (ledger, fail_receive_bad_signature) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - auto result3 = ledger.process (transaction, *block3); + auto result3 = ledger.process (transaction, block3); ASSERT_EQ (nano::block_status::progress, result3); auto block4 = builder .receive () @@ -1804,7 +1804,7 @@ TEST (ledger, fail_receive_bad_signature) .sign (nano::keypair ().prv, 0) .work (*pool.generate (block3->hash ())) .build (); - auto result4 = ledger.process (transaction, *block4); + auto result4 = ledger.process (transaction, block4); ASSERT_EQ (nano::block_status::bad_signature, result4); } @@ -1825,7 +1825,7 @@ TEST (ledger, fail_receive_gap_previous_opened) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block1); + auto result1 = ledger.process (transaction, block1); ASSERT_EQ (nano::block_status::progress, result1); auto block2 = builder .send () @@ -1835,7 +1835,7 @@ TEST (ledger, fail_receive_gap_previous_opened) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block1->hash ())) .build (); - auto result2 = ledger.process (transaction, *block2); + auto result2 = ledger.process (transaction, block2); ASSERT_EQ (nano::block_status::progress, result2); auto block3 = builder .open () @@ -1845,7 +1845,7 @@ TEST (ledger, fail_receive_gap_previous_opened) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - auto result3 = ledger.process (transaction, *block3); + auto result3 = ledger.process (transaction, block3); ASSERT_EQ (nano::block_status::progress, result3); auto block4 = builder .receive () @@ -1854,7 +1854,7 @@ TEST (ledger, fail_receive_gap_previous_opened) .sign (key1.prv, key1.pub) .work (*pool.generate (nano::root (1))) .build (); - auto result4 = ledger.process (transaction, *block4); + auto result4 = ledger.process (transaction, block4); ASSERT_EQ (nano::block_status::gap_previous, result4); } @@ -1875,7 +1875,7 @@ TEST (ledger, fail_receive_gap_previous_unopened) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block1); + auto result1 = ledger.process (transaction, block1); ASSERT_EQ (nano::block_status::progress, result1); auto block2 = builder .send () @@ -1885,7 +1885,7 @@ TEST (ledger, fail_receive_gap_previous_unopened) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block1->hash ())) .build (); - auto result2 = ledger.process (transaction, *block2); + auto result2 = ledger.process (transaction, block2); ASSERT_EQ (nano::block_status::progress, result2); auto block3 = builder .receive () @@ -1894,7 +1894,7 @@ TEST (ledger, fail_receive_gap_previous_unopened) .sign (key1.prv, key1.pub) .work (*pool.generate (nano::root (1))) .build (); - auto result3 = ledger.process (transaction, *block3); + auto result3 = ledger.process (transaction, block3); ASSERT_EQ (nano::block_status::gap_previous, result3); } @@ -1915,7 +1915,7 @@ TEST (ledger, fail_receive_fork_previous) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block1); + auto result1 = ledger.process (transaction, block1); ASSERT_EQ (nano::block_status::progress, result1); auto block2 = builder .send () @@ -1925,7 +1925,7 @@ TEST (ledger, fail_receive_fork_previous) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block1->hash ())) .build (); - auto result2 = ledger.process (transaction, *block2); + auto result2 = ledger.process (transaction, block2); ASSERT_EQ (nano::block_status::progress, result2); auto block3 = builder .open () @@ -1935,7 +1935,7 @@ TEST (ledger, fail_receive_fork_previous) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - auto result3 = ledger.process (transaction, *block3); + auto result3 = ledger.process (transaction, block3); ASSERT_EQ (nano::block_status::progress, result3); nano::keypair key2; auto block4 = builder @@ -1946,7 +1946,7 @@ TEST (ledger, fail_receive_fork_previous) .sign (key1.prv, key1.pub) .work (*pool.generate (block3->hash ())) .build (); - auto result4 = ledger.process (transaction, *block4); + auto result4 = ledger.process (transaction, block4); ASSERT_EQ (nano::block_status::progress, result4); auto block5 = builder .receive () @@ -1955,7 +1955,7 @@ TEST (ledger, fail_receive_fork_previous) .sign (key1.prv, key1.pub) .work (*pool.generate (block3->hash ())) .build (); - auto result5 = ledger.process (transaction, *block5); + auto result5 = ledger.process (transaction, block5); ASSERT_EQ (nano::block_status::fork, result5); } @@ -1976,7 +1976,7 @@ TEST (ledger, fail_receive_received_source) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - auto result1 = ledger.process (transaction, *block1); + auto result1 = ledger.process (transaction, block1); ASSERT_EQ (nano::block_status::progress, result1); auto block2 = builder .send () @@ -1986,7 +1986,7 @@ TEST (ledger, fail_receive_received_source) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block1->hash ())) .build (); - auto result2 = ledger.process (transaction, *block2); + auto result2 = ledger.process (transaction, block2); ASSERT_EQ (nano::block_status::progress, result2); auto block6 = builder .send () @@ -1996,7 +1996,7 @@ TEST (ledger, fail_receive_received_source) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block2->hash ())) .build (); - auto result6 = ledger.process (transaction, *block6); + auto result6 = ledger.process (transaction, block6); ASSERT_EQ (nano::block_status::progress, result6); auto block3 = builder .open () @@ -2006,7 +2006,7 @@ TEST (ledger, fail_receive_received_source) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - auto result3 = ledger.process (transaction, *block3); + auto result3 = ledger.process (transaction, block3); ASSERT_EQ (nano::block_status::progress, result3); nano::keypair key2; auto block4 = builder @@ -2017,7 +2017,7 @@ TEST (ledger, fail_receive_received_source) .sign (key1.prv, key1.pub) .work (*pool.generate (block3->hash ())) .build (); - auto result4 = ledger.process (transaction, *block4); + auto result4 = ledger.process (transaction, block4); ASSERT_EQ (nano::block_status::progress, result4); auto block5 = builder .receive () @@ -2026,7 +2026,7 @@ TEST (ledger, fail_receive_received_source) .sign (key1.prv, key1.pub) .work (*pool.generate (block4->hash ())) .build (); - auto result5 = ledger.process (transaction, *block5); + auto result5 = ledger.process (transaction, block5); ASSERT_EQ (nano::block_status::progress, result5); auto block7 = builder .receive () @@ -2035,7 +2035,7 @@ TEST (ledger, fail_receive_received_source) .sign (key1.prv, key1.pub) .work (*pool.generate (block3->hash ())) .build (); - auto result7 = ledger.process (transaction, *block7); + auto result7 = ledger.process (transaction, block7); ASSERT_EQ (nano::block_status::fork, result7); } @@ -2069,7 +2069,7 @@ TEST (ledger, latest_root) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (hash1)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); ASSERT_EQ (send->hash (), ledger.latest_root (transaction, nano::dev::genesis_key.pub).as_block_hash ()); } @@ -2091,7 +2091,7 @@ TEST (ledger, change_representative_move_representation) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); ASSERT_EQ (0, ledger.weight (nano::dev::genesis_key.pub)); nano::keypair key2; auto change = builder @@ -2101,7 +2101,7 @@ TEST (ledger, change_representative_move_representation) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *change)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change)); nano::keypair key3; auto open = builder .open () @@ -2111,7 +2111,7 @@ TEST (ledger, change_representative_move_representation) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.weight (key3.pub)); } @@ -2134,7 +2134,7 @@ TEST (ledger, send_open_receive_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (info1->head)) .build (); - auto return1 = ledger.process (transaction, *send1); + auto return1 = ledger.process (transaction, send1); ASSERT_EQ (nano::block_status::progress, return1); auto send2 = builder .send () @@ -2144,7 +2144,7 @@ TEST (ledger, send_open_receive_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - auto return2 = ledger.process (transaction, *send2); + auto return2 = ledger.process (transaction, send2); ASSERT_EQ (nano::block_status::progress, return2); nano::keypair key2; auto open = builder @@ -2155,7 +2155,7 @@ TEST (ledger, send_open_receive_rollback) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - auto return4 = ledger.process (transaction, *open); + auto return4 = ledger.process (transaction, open); ASSERT_EQ (nano::block_status::progress, return4); auto receive = builder .receive () @@ -2164,7 +2164,7 @@ TEST (ledger, send_open_receive_rollback) .sign (key1.prv, key1.pub) .work (*pool.generate (open->hash ())) .build (); - auto return5 = ledger.process (transaction, *receive); + auto return5 = ledger.process (transaction, receive); ASSERT_EQ (nano::block_status::progress, return5); nano::keypair key3; ASSERT_EQ (100, ledger.weight (key2.pub)); @@ -2177,7 +2177,7 @@ TEST (ledger, send_open_receive_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send2->hash ())) .build (); - auto return6 = ledger.process (transaction, *change1); + auto return6 = ledger.process (transaction, change1); ASSERT_EQ (nano::block_status::progress, return6); ASSERT_EQ (100, ledger.weight (key2.pub)); ASSERT_EQ (0, ledger.weight (nano::dev::genesis_key.pub)); @@ -2224,7 +2224,7 @@ TEST (ledger, bootstrap_rep_weight) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (info1->head)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); } ASSERT_EQ (2, ledger.cache.block_count); { @@ -2245,7 +2245,7 @@ TEST (ledger, bootstrap_rep_weight) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (info1->head)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); } ASSERT_EQ (3, ledger.cache.block_count); ASSERT_EQ (0, ledger.weight (key2.pub)); @@ -2320,12 +2320,12 @@ TEST (ledger, block_destination_source) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (block5->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block1)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block2)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block3)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block4)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block5)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *block6)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block4)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block5)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, block6)); ASSERT_EQ (balance, ledger.balance (transaction, block6->hash ())); ASSERT_EQ (dest.pub, ledger.block_destination (transaction, *block1)); ASSERT_TRUE (ledger.block_source (transaction, *block1).is_zero ()); @@ -2359,7 +2359,7 @@ TEST (ledger, state_account) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_EQ (nano::dev::genesis->account (), ledger.account (transaction, send1->hash ())); } @@ -2381,7 +2381,7 @@ TEST (ledger, state_send_receive) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store.block.exists (transaction, send1->hash ())); auto send2 = store.block.get (transaction, send1->hash ()); ASSERT_NE (nullptr, send2); @@ -2404,7 +2404,7 @@ TEST (ledger, state_send_receive) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_TRUE (store.block.exists (transaction, receive1->hash ())); auto receive2 = store.block.get (transaction, receive1->hash ()); ASSERT_NE (nullptr, receive2); @@ -2436,7 +2436,7 @@ TEST (ledger, state_receive) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store.block.exists (transaction, send1->hash ())); auto send2 = store.block.get (transaction, send1->hash ()); ASSERT_NE (nullptr, send2); @@ -2454,7 +2454,7 @@ TEST (ledger, state_receive) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_TRUE (store.block.exists (transaction, receive1->hash ())); auto receive2 = store.block.get (transaction, receive1->hash ()); ASSERT_NE (nullptr, receive2); @@ -2487,7 +2487,7 @@ TEST (ledger, state_rep_change) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *change1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change1)); ASSERT_TRUE (store.block.exists (transaction, change1->hash ())); auto change2 = store.block.get (transaction, change1->hash ()); ASSERT_NE (nullptr, change2); @@ -2521,7 +2521,7 @@ TEST (ledger, state_open) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store.block.exists (transaction, send1->hash ())); auto send2 = store.block.get (transaction, send1->hash ()); ASSERT_NE (nullptr, send2); @@ -2540,7 +2540,7 @@ TEST (ledger, state_open) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); ASSERT_FALSE (store.pending.exists (transaction, nano::pending_key (destination.pub, send1->hash ()))); ASSERT_TRUE (store.block.exists (transaction, open1->hash ())); auto open2 = store.block.get (transaction, open1->hash ()); @@ -2575,7 +2575,7 @@ TEST (ledger, send_after_state_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto send2 = builder .send () .previous (send1->hash ()) @@ -2584,7 +2584,7 @@ TEST (ledger, send_after_state_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, send2)); } // Make sure old block types can't be inserted after a state block. @@ -2606,7 +2606,7 @@ TEST (ledger, receive_after_state_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto receive1 = builder .receive () .previous (send1->hash ()) @@ -2614,7 +2614,7 @@ TEST (ledger, receive_after_state_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, receive1)); } // Make sure old block types can't be inserted after a state block. @@ -2636,7 +2636,7 @@ TEST (ledger, change_after_state_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); nano::keypair rep; auto change1 = builder .change () @@ -2645,7 +2645,7 @@ TEST (ledger, change_after_state_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, *change1)); + ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, change1)); } TEST (ledger, state_unreceivable_fail) @@ -2664,7 +2664,7 @@ TEST (ledger, state_unreceivable_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store.block.exists (transaction, send1->hash ())); auto send2 = store.block.get (transaction, send1->hash ()); ASSERT_NE (nullptr, send2); @@ -2682,7 +2682,7 @@ TEST (ledger, state_unreceivable_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::gap_source, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::gap_source, ledger.process (transaction, receive1)); } TEST (ledger, state_receive_bad_amount_fail) @@ -2701,7 +2701,7 @@ TEST (ledger, state_receive_bad_amount_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store.block.exists (transaction, send1->hash ())); auto send2 = store.block.get (transaction, send1->hash ()); ASSERT_NE (nullptr, send2); @@ -2719,7 +2719,7 @@ TEST (ledger, state_receive_bad_amount_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::balance_mismatch, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::balance_mismatch, ledger.process (transaction, receive1)); } TEST (ledger, state_no_link_amount_fail) @@ -2740,7 +2740,7 @@ TEST (ledger, state_no_link_amount_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); nano::keypair rep; auto change1 = builder .state () @@ -2752,7 +2752,7 @@ TEST (ledger, state_no_link_amount_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::balance_mismatch, ledger.process (transaction, *change1)); + ASSERT_EQ (nano::block_status::balance_mismatch, ledger.process (transaction, change1)); } TEST (ledger, state_receive_wrong_account_fail) @@ -2773,7 +2773,7 @@ TEST (ledger, state_receive_wrong_account_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store.block.exists (transaction, send1->hash ())); auto send2 = store.block.get (transaction, send1->hash ()); ASSERT_NE (nullptr, send2); @@ -2792,7 +2792,7 @@ TEST (ledger, state_receive_wrong_account_fail) .sign (key.prv, key.pub) .work (*pool.generate (key.pub)) .build (); - ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, receive1)); } TEST (ledger, state_open_state_fork) @@ -2814,7 +2814,7 @@ TEST (ledger, state_open_state_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto open1 = builder .state () .account (destination.pub) @@ -2825,7 +2825,7 @@ TEST (ledger, state_open_state_fork) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); auto open2 = builder .open () .source (send1->hash ()) @@ -2834,7 +2834,7 @@ TEST (ledger, state_open_state_fork) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *open2)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, open2)); ASSERT_EQ (open1->root (), open2->root ()); } @@ -2857,7 +2857,7 @@ TEST (ledger, state_state_open_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto open1 = builder .open () .source (send1->hash ()) @@ -2866,7 +2866,7 @@ TEST (ledger, state_state_open_fork) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); auto open2 = builder .state () .account (destination.pub) @@ -2877,7 +2877,7 @@ TEST (ledger, state_state_open_fork) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *open2)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, open2)); ASSERT_EQ (open1->root (), open2->root ()); ASSERT_EQ (store.account.count (transaction), ledger.cache.account_count); } @@ -2901,7 +2901,7 @@ TEST (ledger, state_open_previous_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto open1 = builder .state () .account (destination.pub) @@ -2912,7 +2912,7 @@ TEST (ledger, state_open_previous_fail) .sign (destination.prv, destination.pub) .work (*pool.generate (1)) .build (); - ASSERT_EQ (nano::block_status::gap_previous, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::gap_previous, ledger.process (transaction, open1)); } TEST (ledger, state_open_source_fail) @@ -2934,7 +2934,7 @@ TEST (ledger, state_open_source_fail) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto open1 = builder .state () .account (destination.pub) @@ -2945,7 +2945,7 @@ TEST (ledger, state_open_source_fail) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::gap_source, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::gap_source, ledger.process (transaction, open1)); } TEST (ledger, state_send_change) @@ -2967,7 +2967,7 @@ TEST (ledger, state_send_change) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store.block.exists (transaction, send1->hash ())); auto send2 = store.block.get (transaction, send1->hash ()); ASSERT_NE (nullptr, send2); @@ -3000,7 +3000,7 @@ TEST (ledger, state_receive_change) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store.block.exists (transaction, send1->hash ())); auto send2 = store.block.get (transaction, send1->hash ()); ASSERT_NE (nullptr, send2); @@ -3019,7 +3019,7 @@ TEST (ledger, state_receive_change) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_TRUE (store.block.exists (transaction, receive1->hash ())); auto receive2 = store.block.get (transaction, receive1->hash ()); ASSERT_NE (nullptr, receive2); @@ -3053,7 +3053,7 @@ TEST (ledger, state_open_old) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto open1 = builder .open () .source (send1->hash ()) @@ -3062,7 +3062,7 @@ TEST (ledger, state_open_old) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); ASSERT_EQ (nano::Gxrb_ratio, ledger.balance (transaction, open1->hash ())); ASSERT_EQ (nano::Gxrb_ratio, ledger.amount (transaction, open1->hash ())); ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.weight (nano::dev::genesis->account ())); @@ -3087,7 +3087,7 @@ TEST (ledger, state_receive_old) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto send2 = builder .state () .account (nano::dev::genesis->account ()) @@ -3098,7 +3098,7 @@ TEST (ledger, state_receive_old) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); auto open1 = builder .open () .source (send1->hash ()) @@ -3107,7 +3107,7 @@ TEST (ledger, state_receive_old) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); auto receive1 = builder .receive () .previous (open1->hash ()) @@ -3115,7 +3115,7 @@ TEST (ledger, state_receive_old) .sign (destination.prv, destination.pub) .work (*pool.generate (open1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_EQ (2 * nano::Gxrb_ratio, ledger.balance (transaction, receive1->hash ())); ASSERT_EQ (nano::Gxrb_ratio, ledger.amount (transaction, receive1->hash ())); ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.weight (nano::dev::genesis->account ())); @@ -3139,7 +3139,7 @@ TEST (ledger, state_rollback_send) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store.block.exists (transaction, send1->hash ())); auto send2 = store.block.get (transaction, send1->hash ()); ASSERT_NE (nullptr, send2); @@ -3177,7 +3177,7 @@ TEST (ledger, state_rollback_receive) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto receive1 = builder .state () .account (nano::dev::genesis->account ()) @@ -3188,7 +3188,7 @@ TEST (ledger, state_rollback_receive) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_FALSE (store.pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), receive1->hash ()))); ASSERT_FALSE (ledger.rollback (transaction, receive1->hash ())); auto info = ledger.pending_info (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ())); @@ -3220,7 +3220,7 @@ TEST (ledger, state_rollback_received_send) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto receive1 = builder .state () .account (key.pub) @@ -3231,7 +3231,7 @@ TEST (ledger, state_rollback_received_send) .sign (key.prv, key.pub) .work (*pool.generate (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_FALSE (store.pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), receive1->hash ()))); ASSERT_FALSE (ledger.rollback (transaction, send1->hash ())); ASSERT_FALSE (store.pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ()))); @@ -3263,7 +3263,7 @@ TEST (ledger, state_rep_change_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *change1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change1)); ASSERT_FALSE (ledger.rollback (transaction, change1->hash ())); ASSERT_FALSE (store.block.exists (transaction, change1->hash ())); ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.account_balance (transaction, nano::dev::genesis->account ())); @@ -3290,7 +3290,7 @@ TEST (ledger, state_open_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto open1 = builder .state () .account (destination.pub) @@ -3301,7 +3301,7 @@ TEST (ledger, state_open_rollback) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); ASSERT_FALSE (ledger.rollback (transaction, open1->hash ())); ASSERT_FALSE (store.block.exists (transaction, open1->hash ())); ASSERT_EQ (0, ledger.account_balance (transaction, destination.pub)); @@ -3332,7 +3332,7 @@ TEST (ledger, state_send_change_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_FALSE (ledger.rollback (transaction, send1->hash ())); ASSERT_FALSE (store.block.exists (transaction, send1->hash ())); ASSERT_EQ (nano::dev::constants.genesis_amount, ledger.account_balance (transaction, nano::dev::genesis->account ())); @@ -3359,7 +3359,7 @@ TEST (ledger, state_receive_change_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); nano::keypair rep; auto receive1 = builder .state () @@ -3371,7 +3371,7 @@ TEST (ledger, state_receive_change_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_FALSE (ledger.rollback (transaction, receive1->hash ())); ASSERT_FALSE (store.block.exists (transaction, receive1->hash ())); ASSERT_EQ (nano::dev::constants.genesis_amount - nano::Gxrb_ratio, ledger.account_balance (transaction, nano::dev::genesis->account ())); @@ -3399,7 +3399,7 @@ TEST (ledger, epoch_blocks_v1_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch1)); ASSERT_FALSE (epoch1->sideband ().details.is_send); ASSERT_FALSE (epoch1->sideband ().details.is_receive); ASSERT_TRUE (epoch1->sideband ().details.is_epoch); @@ -3415,7 +3415,7 @@ TEST (ledger, epoch_blocks_v1_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch1->hash ())) .build (); - ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, *epoch2)); + ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, epoch2)); auto genesis_info = ledger.account_info (transaction, nano::dev::genesis->account ()); ASSERT_TRUE (genesis_info); ASSERT_EQ (genesis_info->epoch (), nano::epoch::epoch_1); @@ -3423,7 +3423,7 @@ TEST (ledger, epoch_blocks_v1_general) genesis_info = ledger.account_info (transaction, nano::dev::genesis->account ()); ASSERT_TRUE (genesis_info); ASSERT_EQ (genesis_info->epoch (), nano::epoch::epoch_0); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch1)); genesis_info = ledger.account_info (transaction, nano::dev::genesis->account ()); ASSERT_TRUE (genesis_info); ASSERT_EQ (genesis_info->epoch (), nano::epoch::epoch_1); @@ -3439,7 +3439,7 @@ TEST (ledger, epoch_blocks_v1_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch1->hash ())) .build (); - ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, *change1)); + ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, change1)); auto send1 = builder .state () .account (nano::dev::genesis->account ()) @@ -3450,7 +3450,7 @@ TEST (ledger, epoch_blocks_v1_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (send1->sideband ().details.is_send); ASSERT_FALSE (send1->sideband ().details.is_receive); ASSERT_FALSE (send1->sideband ().details.is_epoch); @@ -3464,7 +3464,7 @@ TEST (ledger, epoch_blocks_v1_general) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, open1)); auto epoch3 = builder .state () .account (destination.pub) @@ -3475,7 +3475,7 @@ TEST (ledger, epoch_blocks_v1_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::representative_mismatch, ledger.process (transaction, *epoch3)); + ASSERT_EQ (nano::block_status::representative_mismatch, ledger.process (transaction, epoch3)); auto epoch4 = builder .state () .account (destination.pub) @@ -3486,7 +3486,7 @@ TEST (ledger, epoch_blocks_v1_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch4)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch4)); ASSERT_FALSE (epoch4->sideband ().details.is_send); ASSERT_FALSE (epoch4->sideband ().details.is_receive); ASSERT_TRUE (epoch4->sideband ().details.is_epoch); @@ -3499,7 +3499,7 @@ TEST (ledger, epoch_blocks_v1_general) .sign (destination.prv, destination.pub) .work (*pool.generate (epoch4->hash ())) .build (); - ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, receive1)); auto receive2 = builder .state () .account (destination.pub) @@ -3510,7 +3510,7 @@ TEST (ledger, epoch_blocks_v1_general) .sign (destination.prv, destination.pub) .work (*pool.generate (epoch4->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive2)); ASSERT_EQ (nano::epoch::epoch_1, receive2->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_1, receive2->sideband ().source_epoch); ASSERT_EQ (0, ledger.balance (transaction, epoch4->hash ())); @@ -3543,7 +3543,7 @@ TEST (ledger, epoch_blocks_v2_general) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); // Trying to upgrade from epoch 0 to epoch 2. It is a requirement epoch upgrades are sequential unless the account is unopened - ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, *epoch1)); + ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, epoch1)); // Set it to the first epoch and it should now succeed epoch1 = builder .state () @@ -3555,7 +3555,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (epoch1->work) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch1)); ASSERT_EQ (nano::epoch::epoch_1, epoch1->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_0, epoch1->sideband ().source_epoch); // Not used for epoch blocks auto epoch2 = builder @@ -3568,7 +3568,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch2)); ASSERT_EQ (nano::epoch::epoch_2, epoch2->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_0, epoch2->sideband ().source_epoch); // Not used for epoch blocks auto epoch3 = builder @@ -3581,7 +3581,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch2->hash ())) .build (); - ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, *epoch3)); + ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, epoch3)); auto genesis_info = ledger.account_info (transaction, nano::dev::genesis->account ()); ASSERT_TRUE (genesis_info); ASSERT_EQ (genesis_info->epoch (), nano::epoch::epoch_2); @@ -3589,7 +3589,7 @@ TEST (ledger, epoch_blocks_v2_general) genesis_info = ledger.account_info (transaction, nano::dev::genesis->account ()); ASSERT_TRUE (genesis_info); ASSERT_EQ (genesis_info->epoch (), nano::epoch::epoch_0); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch1)); genesis_info = ledger.account_info (transaction, nano::dev::genesis->account ()); ASSERT_TRUE (genesis_info); ASSERT_EQ (genesis_info->epoch (), nano::epoch::epoch_1); @@ -3600,7 +3600,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch1->hash ())) .build (); - ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, *change1)); + ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, change1)); auto send1 = builder .state () .account (nano::dev::genesis->account ()) @@ -3611,7 +3611,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_EQ (nano::epoch::epoch_1, send1->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_0, send1->sideband ().source_epoch); // Not used for send blocks auto open1 = builder @@ -3622,7 +3622,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, open1)); auto epoch4 = builder .state () .account (destination.pub) @@ -3633,7 +3633,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch4)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch4)); ASSERT_EQ (nano::epoch::epoch_1, epoch4->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_0, epoch4->sideband ().source_epoch); // Not used for epoch blocks auto epoch5 = builder @@ -3646,7 +3646,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch4->hash ())) .build (); - ASSERT_EQ (nano::block_status::representative_mismatch, ledger.process (transaction, *epoch5)); + ASSERT_EQ (nano::block_status::representative_mismatch, ledger.process (transaction, epoch5)); auto epoch6 = builder .state () .account (destination.pub) @@ -3657,7 +3657,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch4->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch6)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch6)); ASSERT_EQ (nano::epoch::epoch_2, epoch6->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_0, epoch6->sideband ().source_epoch); // Not used for epoch blocks auto receive1 = builder @@ -3667,7 +3667,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (destination.prv, destination.pub) .work (*pool.generate (epoch6->hash ())) .build (); - ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::block_position, ledger.process (transaction, receive1)); auto receive2 = builder .state () .account (destination.pub) @@ -3678,7 +3678,7 @@ TEST (ledger, epoch_blocks_v2_general) .sign (destination.prv, destination.pub) .work (*pool.generate (epoch6->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive2)); ASSERT_EQ (nano::epoch::epoch_2, receive2->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_1, receive2->sideband ().source_epoch); ASSERT_EQ (0, ledger.balance (transaction, epoch6->hash ())); @@ -3707,7 +3707,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto epoch1 = builder .state () .account (nano::dev::genesis->account ()) @@ -3718,7 +3718,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch1)); auto send2 = builder .state () .account (nano::dev::genesis->account ()) @@ -3729,7 +3729,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); ASSERT_EQ (nano::epoch::epoch_1, send2->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_0, send2->sideband ().source_epoch); // Not used for send blocks auto open1 = builder @@ -3740,7 +3740,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (destination.prv, destination.pub) .work (*pool.generate (destination.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); ASSERT_EQ (nano::epoch::epoch_0, open1->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_0, open1->sideband ().source_epoch); auto receive1 = builder @@ -3750,7 +3750,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (destination.prv, destination.pub) .work (*pool.generate (open1->hash ())) .build (); - ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, receive1)); auto receive2 = builder .state () .account (destination.pub) @@ -3761,7 +3761,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (destination.prv, destination.pub) .work (*pool.generate (open1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive2)); ASSERT_EQ (nano::epoch::epoch_1, receive2->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_1, receive2->sideband ().source_epoch); auto destination_info = ledger.account_info (transaction, destination.pub); @@ -3776,7 +3776,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) ASSERT_EQ (nano::dev::genesis_key.pub, pending_send2->source); ASSERT_EQ (nano::Gxrb_ratio, pending_send2->amount.number ()); ASSERT_EQ (nano::epoch::epoch_1, pending_send2->epoch); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive2)); ASSERT_EQ (nano::epoch::epoch_1, receive2->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_1, receive2->sideband ().source_epoch); destination_info = ledger.account_info (transaction, destination.pub); @@ -3793,7 +3793,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (destination.prv, destination.pub) .work (*pool.generate (receive2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send3)); auto open2 = builder .open () .source (send3->hash ()) @@ -3802,7 +3802,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (destination2.prv, destination2.pub) .work (*pool.generate (destination2.pub)) .build (); - ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, *open2)); + ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, open2)); // Upgrade to epoch 2 and send to destination. Try to create an open block from an epoch 2 source block. nano::keypair destination3; auto epoch2 = builder @@ -3815,7 +3815,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch2)); auto send4 = builder .state () .account (nano::dev::genesis->account ()) @@ -3826,7 +3826,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send4)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send4)); auto open3 = builder .open () .source (send4->hash ()) @@ -3835,7 +3835,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (destination3.prv, destination3.pub) .work (*pool.generate (destination3.pub)) .build (); - ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, *open3)); + ASSERT_EQ (nano::block_status::unreceivable, ledger.process (transaction, open3)); // Send it to an epoch 1 account auto send5 = builder .state () @@ -3847,7 +3847,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send4->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send5)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send5)); destination_info = ledger.account_info (transaction, destination.pub); ASSERT_TRUE (destination_info); ASSERT_EQ (destination_info->epoch (), nano::epoch::epoch_1); @@ -3861,7 +3861,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (destination.prv, destination.pub) .work (*pool.generate (send3->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive3)); ASSERT_EQ (nano::epoch::epoch_2, receive3->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_2, receive3->sideband ().source_epoch); destination_info = ledger.account_info (transaction, destination.pub); @@ -3879,7 +3879,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send5->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send6)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send6)); auto epoch4 = builder .state () .account (destination4.pub) @@ -3890,7 +3890,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (destination4.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch4)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch4)); ASSERT_EQ (nano::epoch::epoch_2, epoch4->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_0, epoch4->sideband ().source_epoch); // Not used for epoch blocks ASSERT_EQ (store.account.count (transaction), ledger.cache.account_count); @@ -3913,7 +3913,7 @@ TEST (ledger, epoch_blocks_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto epoch1 = builder .state () .account (nano::dev::genesis->account ()) @@ -3924,7 +3924,7 @@ TEST (ledger, epoch_blocks_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *epoch1)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, epoch1)); auto epoch2 = builder .state () .account (nano::dev::genesis->account ()) @@ -3935,7 +3935,7 @@ TEST (ledger, epoch_blocks_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *epoch2)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, epoch2)); auto epoch3 = builder .state () .account (nano::dev::genesis->account ()) @@ -3946,7 +3946,7 @@ TEST (ledger, epoch_blocks_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch3)); ASSERT_EQ (nano::epoch::epoch_1, epoch3->sideband ().details.epoch); ASSERT_EQ (nano::epoch::epoch_0, epoch3->sideband ().source_epoch); // Not used for epoch state blocks auto epoch4 = builder @@ -3959,7 +3959,7 @@ TEST (ledger, epoch_blocks_fork) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, *epoch2)); + ASSERT_EQ (nano::block_status::fork, ledger.process (transaction, epoch2)); } TEST (ledger, successor_epoch) @@ -4017,11 +4017,11 @@ TEST (ledger, successor_epoch) .work (*pool.generate (open->hash ())) .build (); auto transaction (node1.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *open)); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *change)); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *send2)); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *epoch_open)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, open)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, change)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, send2)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, epoch_open)); ASSERT_EQ (*change, *node1.ledger.successor (transaction, change->qualified_root ())); ASSERT_EQ (*epoch_open, *node1.ledger.successor (transaction, epoch_open->qualified_root ())); ASSERT_EQ (nano::epoch::epoch_1, epoch_open->sideband ().details.epoch); @@ -4043,8 +4043,8 @@ TEST (ledger, epoch_open_pending) .link (node1.ledger.epoch_link (nano::epoch::epoch_1)) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (key1.pub)) - .build_shared (); - auto process_result = node1.ledger.process (node1.store.tx_begin_write (), *epoch_open); + .build (); + auto process_result = node1.ledger.process (node1.store.tx_begin_write (), epoch_open); ASSERT_EQ (nano::block_status::gap_epoch_open_pending, process_result); node1.block_processor.add (epoch_open); // Waits for the block to get saved in the database @@ -4063,7 +4063,7 @@ TEST (ledger, epoch_open_pending) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1.block_processor.add (send1); ASSERT_TIMELY (10s, node1.ledger.block_or_pruned_exists (epoch_open->hash ())); } @@ -4089,7 +4089,7 @@ TEST (ledger, block_hash_account_conflict) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto receive1 = builder.state () .account (key1.pub) @@ -4099,7 +4099,7 @@ TEST (ledger, block_hash_account_conflict) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) - .build_shared (); + .build (); /* * Note that the below link is a block hash when this is intended @@ -4115,7 +4115,7 @@ TEST (ledger, block_hash_account_conflict) .link (receive1->hash ()) .sign (key1.prv, key1.pub) .work (*pool.generate (receive1->hash ())) - .build_shared (); + .build (); /* * Generate an epoch open for the account with the same value as the block hash @@ -4129,16 +4129,16 @@ TEST (ledger, block_hash_account_conflict) .link (node1.ledger.epoch_link (nano::epoch::epoch_1)) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (receive1->hash ())) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); node1.work_generate_blocking (*receive1); node1.work_generate_blocking (*send2); node1.work_generate_blocking (*open_epoch1); - ASSERT_EQ (nano::block_status::progress, node1.process (*send1)); - ASSERT_EQ (nano::block_status::progress, node1.process (*receive1)); - ASSERT_EQ (nano::block_status::progress, node1.process (*send2)); - ASSERT_EQ (nano::block_status::progress, node1.process (*open_epoch1)); + ASSERT_EQ (nano::block_status::progress, node1.process (send1)); + ASSERT_EQ (nano::block_status::progress, node1.process (receive1)); + ASSERT_EQ (nano::block_status::progress, node1.process (send2)); + ASSERT_EQ (nano::block_status::progress, node1.process (open_epoch1)); ASSERT_TRUE (nano::test::start_elections (system, node1, { send1, receive1, send2, open_epoch1 })); auto election1 = node1.active.election (send1->qualified_root ()); ASSERT_NE (nullptr, election1); @@ -4212,7 +4212,7 @@ TEST (ledger, could_fit) .build (); ASSERT_FALSE (ledger.could_fit (transaction, *send1)); ASSERT_FALSE (ledger.could_fit (transaction, *send2)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *change1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change1)); ASSERT_TRUE (ledger.could_fit (transaction, *change1)); ASSERT_TRUE (ledger.could_fit (transaction, *change2)); ASSERT_TRUE (ledger.could_fit (transaction, *send1)); @@ -4238,12 +4238,12 @@ TEST (ledger, could_fit) .build (); ASSERT_FALSE (ledger.could_fit (transaction, *open1)); ASSERT_FALSE (ledger.could_fit (transaction, *open2)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); ASSERT_TRUE (ledger.could_fit (transaction, *send1)); ASSERT_TRUE (ledger.could_fit (transaction, *send2)); ASSERT_TRUE (ledger.could_fit (transaction, *open1)); ASSERT_TRUE (ledger.could_fit (transaction, *open2)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); ASSERT_TRUE (ledger.could_fit (transaction, *open1)); ASSERT_TRUE (ledger.could_fit (transaction, *open2)); // Create another send to receive @@ -4277,7 +4277,7 @@ TEST (ledger, could_fit) .build (); ASSERT_FALSE (ledger.could_fit (transaction, *receive1)); ASSERT_FALSE (ledger.could_fit (transaction, *receive2)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send3)); ASSERT_TRUE (ledger.could_fit (transaction, *receive1)); ASSERT_TRUE (ledger.could_fit (transaction, *receive2)); // Test epoch (state) @@ -4292,11 +4292,11 @@ TEST (ledger, could_fit) .work (*pool.generate (receive1->hash ())) .build (); ASSERT_FALSE (ledger.could_fit (transaction, *epoch1)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_TRUE (ledger.could_fit (transaction, *receive1)); ASSERT_TRUE (ledger.could_fit (transaction, *receive2)); ASSERT_TRUE (ledger.could_fit (transaction, *epoch1)); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch1)); ASSERT_TRUE (ledger.could_fit (transaction, *epoch1)); } @@ -4315,7 +4315,7 @@ TEST (ledger, unchecked_epoch) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); auto open1 = builder .state () @@ -4326,7 +4326,7 @@ TEST (ledger, unchecked_epoch) .link (send1->hash ()) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*open1); auto epoch1 = builder .state () @@ -4337,7 +4337,7 @@ TEST (ledger, unchecked_epoch) .link (node1.ledger.epoch_link (nano::epoch::epoch_1)) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*epoch1); node1.block_processor.add (epoch1); { @@ -4375,7 +4375,7 @@ TEST (ledger, unchecked_epoch_invalid) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); auto open1 = builder .state () @@ -4386,7 +4386,7 @@ TEST (ledger, unchecked_epoch_invalid) .link (send1->hash ()) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*open1); // Epoch block with account own signature auto epoch1 = builder @@ -4398,7 +4398,7 @@ TEST (ledger, unchecked_epoch_invalid) .link (node1.ledger.epoch_link (nano::epoch::epoch_1)) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*epoch1); // Pseudo epoch block (send subtype, destination - epoch link) auto epoch2 = builder @@ -4410,7 +4410,7 @@ TEST (ledger, unchecked_epoch_invalid) .link (node1.ledger.epoch_link (nano::epoch::epoch_1)) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*epoch2); node1.block_processor.add (epoch1); node1.block_processor.add (epoch2); @@ -4457,7 +4457,7 @@ TEST (ledger, unchecked_open) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); auto open1 = builder .open () @@ -4466,7 +4466,7 @@ TEST (ledger, unchecked_open) .account (destination.pub) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*open1); // Invalid signature for open block auto open2 = builder @@ -4476,7 +4476,7 @@ TEST (ledger, unchecked_open) .account (destination.pub) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*open2); open2->signature.bytes[0] ^= 1; node1.block_processor.add (open2); // Insert open2 in to the queue before open1 @@ -4509,7 +4509,7 @@ TEST (ledger, unchecked_receive) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); auto send2 = builder .state () @@ -4520,7 +4520,7 @@ TEST (ledger, unchecked_receive) .link (destination.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send2); auto open1 = builder .open () @@ -4529,7 +4529,7 @@ TEST (ledger, unchecked_receive) .account (destination.pub) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*open1); auto receive1 = builder .receive () @@ -4537,7 +4537,7 @@ TEST (ledger, unchecked_receive) .source (send2->hash ()) .sign (destination.prv, destination.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*receive1); node1.block_processor.add (send1); node1.block_processor.add (receive1); @@ -4588,7 +4588,7 @@ TEST (ledger, confirmation_height_not_updated) ASSERT_FALSE (store.confirmation_height.get (transaction, nano::dev::genesis->account (), confirmation_height_info)); ASSERT_EQ (1, confirmation_height_info.height); ASSERT_EQ (nano::dev::genesis->hash (), confirmation_height_info.frontier); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_FALSE (store.confirmation_height.get (transaction, nano::dev::genesis->account (), confirmation_height_info)); ASSERT_EQ (1, confirmation_height_info.height); ASSERT_EQ (nano::dev::genesis->hash (), confirmation_height_info.frontier); @@ -4600,7 +4600,7 @@ TEST (ledger, confirmation_height_not_updated) .sign (key.prv, key.pub) .work (*pool.generate (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); ASSERT_TRUE (store.confirmation_height.get (transaction, key.pub, confirmation_height_info)); ASSERT_EQ (0, confirmation_height_info.height); ASSERT_EQ (nano::block_hash (0), confirmation_height_info.frontier); @@ -4621,7 +4621,7 @@ TEST (ledger, zero_rep) .work (*system.work.generate (nano::dev::genesis->hash ())) .build (); auto transaction (node1.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *block1)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, block1)); ASSERT_EQ (0, node1.ledger.cache.rep_weights.representation_get (nano::dev::genesis_key.pub)); ASSERT_EQ (nano::dev::constants.genesis_amount, node1.ledger.cache.rep_weights.representation_get (0)); auto block2 = builder.state () @@ -4633,7 +4633,7 @@ TEST (ledger, zero_rep) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (block1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *block2)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, block2)); ASSERT_EQ (nano::dev::constants.genesis_amount, node1.ledger.cache.rep_weights.representation_get (nano::dev::genesis_key.pub)); ASSERT_EQ (0, node1.ledger.cache.rep_weights.representation_get (0)); } @@ -4649,74 +4649,74 @@ TEST (ledger, work_validation) nano::keypair key; // With random work the block doesn't pass, then modifies the block with sufficient work and ensures a correct result - auto process_block = [&store, &ledger, &pool] (nano::block & block_a, nano::block_details const details_a) { - auto threshold = nano::dev::network_params.work.threshold (block_a.work_version (), details_a); + auto process_block = [&store, &ledger, &pool] (std::shared_ptr block_a, nano::block_details const details_a) { + auto threshold = nano::dev::network_params.work.threshold (block_a->work_version (), details_a); // Rarely failed with random work, so modify until it doesn't have enough difficulty - while (nano::dev::network_params.work.difficulty (block_a) >= threshold) + while (nano::dev::network_params.work.difficulty (*block_a) >= threshold) { - block_a.block_work_set (block_a.block_work () + 1); + block_a->block_work_set (block_a->block_work () + 1); } EXPECT_EQ (nano::block_status::insufficient_work, ledger.process (store.tx_begin_write (), block_a)); - block_a.block_work_set (*pool.generate (block_a.root (), threshold)); + block_a->block_work_set (*pool.generate (block_a->root (), threshold)); EXPECT_EQ (nano::block_status::progress, ledger.process (store.tx_begin_write (), block_a)); }; std::error_code ec; - auto send = *builder.send () - .previous (nano::dev::genesis->hash ()) - .destination (gen.pub) - .balance (nano::dev::constants.genesis_amount - 1) - .sign (gen.prv, gen.pub) - .work (0) - .build (ec); - ASSERT_FALSE (ec); - - auto receive = *builder.receive () - .previous (send.hash ()) - .source (send.hash ()) - .sign (gen.prv, gen.pub) - .work (0) - .build (ec); + auto send = builder.send () + .previous (nano::dev::genesis->hash ()) + .destination (gen.pub) + .balance (nano::dev::constants.genesis_amount - 1) + .sign (gen.prv, gen.pub) + .work (0) + .build (ec); ASSERT_FALSE (ec); - auto change = *builder.change () - .previous (receive.hash ()) - .representative (key.pub) + auto receive = builder.receive () + .previous (send->hash ()) + .source (send->hash ()) .sign (gen.prv, gen.pub) .work (0) .build (ec); ASSERT_FALSE (ec); - auto state = *builder.state () - .account (gen.pub) - .previous (change.hash ()) - .representative (gen.pub) - .balance (nano::dev::constants.genesis_amount - 1) - .link (key.pub) + auto change = builder.change () + .previous (receive->hash ()) + .representative (key.pub) .sign (gen.prv, gen.pub) .work (0) .build (ec); ASSERT_FALSE (ec); - auto open = *builder.open () - .account (key.pub) - .source (state.hash ()) - .representative (key.pub) - .sign (key.prv, key.pub) + auto state = builder.state () + .account (gen.pub) + .previous (change->hash ()) + .representative (gen.pub) + .balance (nano::dev::constants.genesis_amount - 1) + .link (key.pub) + .sign (gen.prv, gen.pub) .work (0) .build (ec); ASSERT_FALSE (ec); - auto epoch = *builder.state () - .account (key.pub) - .previous (open.hash ()) - .balance (1) - .representative (key.pub) - .link (ledger.epoch_link (nano::epoch::epoch_1)) - .sign (gen.prv, gen.pub) - .work (0) - .build (ec); + auto open = builder.open () + .account (key.pub) + .source (state->hash ()) + .representative (key.pub) + .sign (key.prv, key.pub) + .work (0) + .build (ec); + ASSERT_FALSE (ec); + + auto epoch = builder.state () + .account (key.pub) + .previous (open->hash ()) + .balance (1) + .representative (key.pub) + .link (ledger.epoch_link (nano::epoch::epoch_1)) + .sign (gen.prv, gen.pub) + .work (0) + .build (ec); ASSERT_FALSE (ec); process_block (send, {}); @@ -4745,8 +4745,8 @@ TEST (ledger, dependents_confirmed) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (ledger.dependents_confirmed (transaction, *send1)); auto send2 = builder.state () .account (nano::dev::genesis->account ()) @@ -4756,8 +4756,8 @@ TEST (ledger, dependents_confirmed) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); ASSERT_FALSE (ledger.dependents_confirmed (transaction, *send2)); auto receive1 = builder.state () .account (key1.pub) @@ -4767,8 +4767,8 @@ TEST (ledger, dependents_confirmed) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + .build (); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_FALSE (ledger.dependents_confirmed (transaction, *receive1)); nano::confirmation_height_info height; ASSERT_FALSE (ledger.store.confirmation_height.get (transaction, nano::dev::genesis->account (), height)); @@ -4783,8 +4783,8 @@ TEST (ledger, dependents_confirmed) .link (send2->hash ()) .sign (key1.prv, key1.pub) .work (*pool.generate (receive1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive2)); + .build (); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive2)); ASSERT_FALSE (ledger.dependents_confirmed (transaction, *receive2)); ASSERT_TRUE (ledger.store.confirmation_height.get (transaction, key1.pub, height)); height.height += 1; @@ -4817,8 +4817,8 @@ TEST (ledger, dependents_confirmed_pruning) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); auto send2 = builder.state () .account (nano::dev::genesis->account ()) .previous (send1->hash ()) @@ -4827,8 +4827,8 @@ TEST (ledger, dependents_confirmed_pruning) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); nano::confirmation_height_info height; ASSERT_FALSE (ledger.store.confirmation_height.get (transaction, nano::dev::genesis->account (), height)); height.height = 3; @@ -4843,7 +4843,7 @@ TEST (ledger, dependents_confirmed_pruning) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) - .build_shared (); + .build (); ASSERT_TRUE (ledger.dependents_confirmed (transaction, *receive1)); } @@ -4868,7 +4868,7 @@ TEST (ledger, block_confirmed) .build (); // Must be safe against non-existing blocks ASSERT_FALSE (ledger.block_confirmed (transaction, send1->hash ())); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_FALSE (ledger.block_confirmed (transaction, send1->hash ())); nano::confirmation_height_info height; ASSERT_FALSE (ledger.store.confirmation_height.get (transaction, nano::dev::genesis->account (), height)); @@ -4927,7 +4927,7 @@ TEST (ledger, cache) .build (); { auto transaction (store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); } ++block_count; @@ -4937,7 +4937,7 @@ TEST (ledger, cache) { auto transaction (store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); } ++block_count; @@ -5008,7 +5008,7 @@ TEST (ledger, pruning_action) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store->block.exists (transaction, send1->hash ())); auto send1_stored (store->block.get (transaction, send1->hash ())); ASSERT_NE (nullptr, send1_stored); @@ -5024,7 +5024,7 @@ TEST (ledger, pruning_action) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); ASSERT_TRUE (store->block.exists (transaction, send2->hash ())); // Pruning action ASSERT_EQ (1, ledger.pruning_action (transaction, send1->hash (), 1)); @@ -5050,7 +5050,7 @@ TEST (ledger, pruning_action) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_TRUE (store->block.exists (transaction, receive1->hash ())); auto receive1_stored (store->block.get (transaction, receive1->hash ())); ASSERT_NE (nullptr, receive1_stored); @@ -5096,7 +5096,7 @@ TEST (ledger, pruning_large_chain) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (last_hash)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); ASSERT_TRUE (store->block.exists (transaction, send->hash ())); auto receive = builder .state () @@ -5108,7 +5108,7 @@ TEST (ledger, pruning_large_chain) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive)); ASSERT_TRUE (store->block.exists (transaction, receive->hash ())); last_hash = receive->hash (); } @@ -5147,7 +5147,7 @@ TEST (ledger, pruning_source_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *epoch1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, epoch1)); auto send1 = builder .state () .account (nano::dev::genesis->account ()) @@ -5158,7 +5158,7 @@ TEST (ledger, pruning_source_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (epoch1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store->pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ()))); auto send2 = builder .state () @@ -5170,7 +5170,7 @@ TEST (ledger, pruning_source_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); ASSERT_TRUE (store->block.exists (transaction, send2->hash ())); // Pruning action ASSERT_EQ (2, ledger.pruning_action (transaction, send1->hash (), 1)); @@ -5195,7 +5195,7 @@ TEST (ledger, pruning_source_rollback) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_FALSE (store->pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ()))); ASSERT_EQ (2, ledger.cache.pruned_count); ASSERT_EQ (5, ledger.cache.block_count); @@ -5207,7 +5207,7 @@ TEST (ledger, pruning_source_rollback) ASSERT_EQ (nano::Gxrb_ratio, info2->amount.number ()); ASSERT_EQ (nano::epoch::epoch_1, info2->epoch); // Process receive block again - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_FALSE (store->pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ()))); ASSERT_EQ (2, ledger.cache.pruned_count); ASSERT_EQ (5, ledger.cache.block_count); @@ -5233,7 +5233,7 @@ TEST (ledger, pruning_source_rollback_legacy) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store->pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ()))); nano::keypair key1; auto send2 = builder @@ -5244,7 +5244,7 @@ TEST (ledger, pruning_source_rollback_legacy) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); ASSERT_TRUE (store->block.exists (transaction, send2->hash ())); ASSERT_TRUE (store->pending.exists (transaction, nano::pending_key (key1.pub, send2->hash ()))); auto send3 = builder @@ -5255,7 +5255,7 @@ TEST (ledger, pruning_source_rollback_legacy) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send3)); ASSERT_TRUE (store->block.exists (transaction, send3->hash ())); ASSERT_TRUE (store->pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send3->hash ()))); // Pruning action @@ -5283,7 +5283,7 @@ TEST (ledger, pruning_source_rollback_legacy) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send3->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_FALSE (store->pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ()))); ASSERT_EQ (2, ledger.cache.pruned_count); ASSERT_EQ (5, ledger.cache.block_count); @@ -5295,7 +5295,7 @@ TEST (ledger, pruning_source_rollback_legacy) ASSERT_EQ (nano::Gxrb_ratio, info3->amount.number ()); ASSERT_EQ (nano::epoch::epoch_0, info3->epoch); // Process receive block again - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); ASSERT_FALSE (store->pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ()))); ASSERT_EQ (2, ledger.cache.pruned_count); ASSERT_EQ (5, ledger.cache.block_count); @@ -5308,7 +5308,7 @@ TEST (ledger, pruning_source_rollback_legacy) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); ASSERT_FALSE (store->pending.exists (transaction, nano::pending_key (key1.pub, send2->hash ()))); ASSERT_EQ (2, ledger.cache.pruned_count); ASSERT_EQ (6, ledger.cache.block_count); @@ -5320,7 +5320,7 @@ TEST (ledger, pruning_source_rollback_legacy) ASSERT_EQ (nano::Gxrb_ratio, info4->amount.number ()); ASSERT_EQ (nano::epoch::epoch_0, info4->epoch); // Process open block again - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); ASSERT_FALSE (store->pending.exists (transaction, nano::pending_key (key1.pub, send2->hash ()))); ASSERT_EQ (2, ledger.cache.pruned_count); ASSERT_EQ (6, ledger.cache.block_count); @@ -5348,7 +5348,7 @@ TEST (ledger, pruning_process_error) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_EQ (0, ledger.cache.pruned_count); ASSERT_EQ (2, ledger.cache.block_count); // Pruning action for latest block (not valid action) @@ -5356,7 +5356,7 @@ TEST (ledger, pruning_process_error) ASSERT_FALSE (store->block.exists (transaction, send1->hash ())); ASSERT_TRUE (store->pruned.exists (transaction, send1->hash ())); // Attempt to process pruned block again - ASSERT_EQ (nano::block_status::old, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::old, ledger.process (transaction, send1)); // Attept to process new block after pruned auto send2 = builder .state () @@ -5368,7 +5368,7 @@ TEST (ledger, pruning_process_error) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::gap_previous, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::gap_previous, ledger.process (transaction, send2)); ASSERT_EQ (1, ledger.cache.pruned_count); ASSERT_EQ (2, ledger.cache.block_count); } @@ -5394,7 +5394,7 @@ TEST (ledger, pruning_legacy_blocks) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store->pending.exists (transaction, nano::pending_key (nano::dev::genesis->account (), send1->hash ()))); auto receive1 = builder .receive () @@ -5403,7 +5403,7 @@ TEST (ledger, pruning_legacy_blocks) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive1)); auto change1 = builder .change () .previous (receive1->hash ()) @@ -5411,7 +5411,7 @@ TEST (ledger, pruning_legacy_blocks) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (receive1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *change1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change1)); auto send2 = builder .send () .previous (change1->hash ()) @@ -5420,7 +5420,7 @@ TEST (ledger, pruning_legacy_blocks) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (change1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); auto open1 = builder .open () .source (send2->hash ()) @@ -5429,7 +5429,7 @@ TEST (ledger, pruning_legacy_blocks) .sign (key1.prv, key1.pub) .work (*pool.generate (key1.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open1)); auto send3 = builder .send () .previous (open1->hash ()) @@ -5438,7 +5438,7 @@ TEST (ledger, pruning_legacy_blocks) .sign (key1.prv, key1.pub) .work (*pool.generate (open1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send3)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send3)); // Pruning action ASSERT_EQ (3, ledger.pruning_action (transaction, change1->hash (), 2)); ASSERT_EQ (1, ledger.pruning_action (transaction, open1->hash (), 1)); @@ -5481,7 +5481,7 @@ TEST (ledger, pruning_safe_functions) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store->block.exists (transaction, send1->hash ())); auto send2 = builder .state () @@ -5493,7 +5493,7 @@ TEST (ledger, pruning_safe_functions) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); ASSERT_TRUE (store->block.exists (transaction, send2->hash ())); // Pruning action ASSERT_EQ (1, ledger.pruning_action (transaction, send1->hash (), 1)); @@ -5542,7 +5542,7 @@ TEST (ledger, hash_root_random) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); ASSERT_TRUE (store->block.exists (transaction, send1->hash ())); auto send2 = builder .state () @@ -5554,7 +5554,7 @@ TEST (ledger, hash_root_random) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); ASSERT_TRUE (store->block.exists (transaction, send2->hash ())); // Pruning action ASSERT_EQ (1, ledger.pruning_action (transaction, send1->hash (), 1)); @@ -5601,7 +5601,7 @@ TEST (ledger, migrate_lmdb_to_rocksdb) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); nano::endpoint_key endpoint_key (address.to_bytes (), port); auto version = nano::store::component::version_current; @@ -5680,7 +5680,7 @@ TEST (ledger, unconfirmed_frontiers) .work (*pool.generate (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (store.tx_begin_write (), *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (store.tx_begin_write (), send)); unconfirmed_frontiers = ledger.unconfirmed_frontiers (); ASSERT_EQ (unconfirmed_frontiers.size (), 1); diff --git a/nano/core_test/message.cpp b/nano/core_test/message.cpp index 024cf03f7f..102af44db8 100644 --- a/nano/core_test/message.cpp +++ b/nano/core_test/message.cpp @@ -20,7 +20,7 @@ std::shared_ptr random_block () .balance (2) .sign (nano::keypair ().prv, 4) .work (5) - .build_shared (); + .build (); return block; } } @@ -818,4 +818,4 @@ TEST (handshake, signature_v2) message.v2->salt = nano::random_pool::generate (); ASSERT_FALSE (message.validate (cookie)); } -} \ No newline at end of file +} diff --git a/nano/core_test/message_deserializer.cpp b/nano/core_test/message_deserializer.cpp index 0954b2c0c4..271330491e 100644 --- a/nano/core_test/message_deserializer.cpp +++ b/nano/core_test/message_deserializer.cpp @@ -65,7 +65,7 @@ TEST (message_deserializer, exact_confirm_ack) .balance (2) .sign (nano::keypair ().prv, 4) .work (*system.work.generate (nano::root (1))) - .build_shared (); + .build (); auto vote (std::make_shared (0, nano::keypair ().prv, 0, 0, std::vector{ block->hash () })); nano::confirm_ack message{ nano::dev::network_params.network, vote }; @@ -101,7 +101,7 @@ TEST (message_deserializer, exact_publish) .balance (2) .sign (nano::keypair ().prv, 4) .work (*system.work.generate (nano::root (1))) - .build_shared (); + .build (); nano::publish message{ nano::dev::network_params.network, block }; message_deserializer_success_checker (message); diff --git a/nano/core_test/network.cpp b/nano/core_test/network.cpp index 98b8fedaa1..e6a514b9ad 100644 --- a/nano/core_test/network.cpp +++ b/nano/core_test/network.cpp @@ -187,7 +187,7 @@ TEST (network, send_discarded_publish) .balance (2) .sign (nano::keypair ().prv, 4) .work (*system.work.generate (nano::root (1))) - .build_shared (); + .build (); { auto transaction (node1.store.tx_begin_read ()); node1.network.flood_block (block); @@ -213,7 +213,7 @@ TEST (network, send_invalid_publish) .balance (20) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::root (1))) - .build_shared (); + .build (); { auto transaction (node1.store.tx_begin_read ()); node1.network.flood_block (block); @@ -299,7 +299,7 @@ TEST (network, send_insufficient_work) .balance (20) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); nano::publish publish1{ nano::dev::network_params.network, block1 }; auto tcp_channel (node1.network.tcp_channels.find_node_id (node2.get_node_id ())); ASSERT_NE (nullptr, tcp_channel); @@ -315,7 +315,7 @@ TEST (network, send_insufficient_work) .balance (20) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (system.work_generate_limited (block1->hash (), node1.network_params.work.epoch_2_receive, node1.network_params.work.epoch_1 - 1)) - .build_shared (); + .build (); nano::publish publish2{ nano::dev::network_params.network, block2 }; tcp_channel->send (publish2, [] (boost::system::error_code const & ec, size_t size) {}); ASSERT_TIMELY (10s, node2.stats.count (nano::stat::type::error, nano::stat::detail::insufficient_work) != 1); @@ -328,7 +328,7 @@ TEST (network, send_insufficient_work) .balance (20) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (block2->hash (), node1.network_params.work.epoch_2)) - .build_shared (); + .build (); nano::publish publish3{ nano::dev::network_params.network, block3 }; tcp_channel->send (publish3, [] (boost::system::error_code const & ec, size_t size) {}); ASSERT_EQ (0, node2.stats.count (nano::stat::type::message, nano::stat::detail::publish, nano::stat::dir::in)); @@ -344,7 +344,7 @@ TEST (network, send_insufficient_work) .link (1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (system.work_generate_limited (block1->hash (), node1.network_params.work.epoch_2_receive, node1.network_params.work.epoch_1 - 1)) - .build_shared (); + .build (); nano::publish publish4{ nano::dev::network_params.network, block4 }; tcp_channel->send (publish4, [] (boost::system::error_code const & ec, size_t size) {}); ASSERT_TIMELY (10s, node2.stats.count (nano::stat::type::message, nano::stat::detail::publish, nano::stat::dir::in) != 0); @@ -364,9 +364,9 @@ TEST (receivable_processor, confirm_insufficient_pos) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*block1); - ASSERT_EQ (nano::block_status::progress, node1.process (*block1)); + ASSERT_EQ (nano::block_status::progress, node1.process (block1)); node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.store.tx_begin_read ()); nano::keypair key1; auto vote = nano::test::make_vote (key1, { block1 }, 0, 0); @@ -387,9 +387,9 @@ TEST (receivable_processor, confirm_sufficient_pos) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*block1); - ASSERT_EQ (nano::block_status::progress, node1.process (*block1)); + ASSERT_EQ (nano::block_status::progress, node1.process (block1)); node1.scheduler.priority.activate (nano::dev::genesis_key.pub, node1.store.tx_begin_read ()); auto vote = nano::test::make_vote (nano::dev::genesis_key, { block1 }, 0, 0); nano::confirm_ack con1{ nano::dev::network_params.network, vote }; @@ -417,7 +417,7 @@ TEST (receivable_processor, send_with_receive) .balance (amount - node1.config.receive_minimum.number ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest1)) - .build_shared (); + .build (); ASSERT_EQ (amount, node1.balance (nano::dev::genesis_key.pub)); ASSERT_EQ (0, node1.balance (key2.pub)); ASSERT_EQ (amount, node2.balance (nano::dev::genesis_key.pub)); diff --git a/nano/core_test/network_filter.cpp b/nano/core_test/network_filter.cpp index 21f6f7ec58..ae7f47e836 100644 --- a/nano/core_test/network_filter.cpp +++ b/nano/core_test/network_filter.cpp @@ -45,7 +45,7 @@ TEST (network_filter, unit) .link (nano::public_key ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); one_block (new_block, false); for (int i = 0; i < 10; ++i) @@ -74,7 +74,7 @@ TEST (network_filter, many) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); nano::publish message{ nano::dev::network_params.network, block }; auto bytes (message.to_bytes ()); diff --git a/nano/core_test/node.cpp b/nano/core_test/node.cpp index 6edce227bd..35c06a9cfa 100644 --- a/nano/core_test/node.cpp +++ b/nano/core_test/node.cpp @@ -171,21 +171,21 @@ TEST (node, send_out_of_order) .balance (std::numeric_limits::max () - node1.config.receive_minimum.number ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .previous (send1->hash ()) .destination (key2.pub) .balance (std::numeric_limits::max () - 2 * node1.config.receive_minimum.number ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); auto send3 = builder.make_block () .previous (send2->hash ()) .destination (key2.pub) .balance (std::numeric_limits::max () - 3 * node1.config.receive_minimum.number ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send2->hash ())) - .build_shared (); + .build (); node1.process_active (send3); node1.process_active (send2); node1.process_active (send1); @@ -207,7 +207,7 @@ TEST (node, quick_confirm) .balance (node1.online_reps.delta () + 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1.process_active (send); ASSERT_TIMELY (10s, !node1.balance (key.pub).is_zero ()); ASSERT_EQ (node1.balance (nano::dev::genesis_key.pub), node1.online_reps.delta () + 1); @@ -227,7 +227,7 @@ TEST (node, node_receive_quorum) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1.process_active (send); ASSERT_TIMELY (10s, node1.ledger.block_or_pruned_exists (send->hash ())); ASSERT_TIMELY (10s, node1.active.election (nano::qualified_root (previous, previous)) != nullptr); @@ -502,7 +502,7 @@ TEST (node, confirm_locked) .balance (0) .sign (nano::keypair ().prv, 0) .work (0) - .build_shared (); + .build (); system.nodes[0]->network.flood_block (block); } @@ -539,7 +539,7 @@ TEST (node, fork_publish) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); nano::keypair key2; auto send2 = builder.make_block () @@ -548,7 +548,7 @@ TEST (node, fork_publish) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send2); node1.process_active (send1); ASSERT_TIMELY_EQ (5s, 1, node1.active.size ()); @@ -590,7 +590,7 @@ TEST (node, fork_publish_inactive) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .previous (nano::dev::genesis->hash ()) @@ -598,7 +598,7 @@ TEST (node, fork_publish_inactive) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (send1->block_work ()) - .build_shared (); + .build (); node.process_active (send1); ASSERT_TIMELY (5s, node.block (send1->hash ())); @@ -637,14 +637,14 @@ TEST (node, fork_keep) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .previous (nano::dev::genesis->hash ()) .destination (key2.pub) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1.process_active (send1); node2.process_active (send1); ASSERT_TIMELY_EQ (5s, 1, node1.active.size ()); @@ -686,7 +686,7 @@ TEST (node, fork_flip) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); nano::publish publish1{ nano::dev::network_params.network, send1 }; nano::keypair key2; auto send2 = builder.make_block () @@ -695,7 +695,7 @@ TEST (node, fork_flip) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); nano::publish publish2{ nano::dev::network_params.network, send2 }; auto ignored_channel{ std::make_shared (node1, std::weak_ptr ()) }; @@ -743,7 +743,7 @@ TEST (node, fork_multi_flip) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); nano::keypair key2; auto send2 = builder.make_block () .previous (nano::dev::genesis->hash ()) @@ -751,18 +751,18 @@ TEST (node, fork_multi_flip) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send3 = builder.make_block () .previous (send2->hash ()) .destination (key2.pub) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send2->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (node1.store.tx_begin_write (), *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (node1.store.tx_begin_write (), send1)); // Node2 has two blocks that will be rolled back by node1's vote - ASSERT_EQ (nano::block_status::progress, node2.ledger.process (node2.store.tx_begin_write (), *send2)); - ASSERT_EQ (nano::block_status::progress, node2.ledger.process (node2.store.tx_begin_write (), *send3)); + ASSERT_EQ (nano::block_status::progress, node2.ledger.process (node2.store.tx_begin_write (), send2)); + ASSERT_EQ (nano::block_status::progress, node2.ledger.process (node2.store.tx_begin_write (), send3)); system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); // Insert voting key in to node1 auto election = nano::test::start_election (system, node2, send2->hash ()); @@ -799,7 +799,7 @@ TEST (node, fork_bootstrap_flip) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system0.work.generate (latest)) - .build_shared (); + .build (); nano::keypair key2; auto send2 = builder.make_block () .previous (latest) @@ -807,10 +807,10 @@ TEST (node, fork_bootstrap_flip) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system0.work.generate (latest)) - .build_shared (); + .build (); // Insert but don't rebroadcast, simulating settled blocks - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (node1.store.tx_begin_write (), *send1)); - ASSERT_EQ (nano::block_status::progress, node2.ledger.process (node2.store.tx_begin_write (), *send2)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (node1.store.tx_begin_write (), send1)); + ASSERT_EQ (nano::block_status::progress, node2.ledger.process (node2.store.tx_begin_write (), send2)); ASSERT_TRUE (node2.store.block.exists (node2.store.tx_begin_read (), send2->hash ())); node2.bootstrap_initiator.bootstrap (node1.network.endpoint ()); // Additionally add new peer to confirm & replace bootstrap block auto again (true); @@ -839,7 +839,7 @@ TEST (node, fork_open) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); nano::publish publish1{ nano::dev::network_params.network, send1 }; auto channel1 = std::make_shared (node); node.network.inbound (publish1, channel1); @@ -859,7 +859,7 @@ TEST (node, fork_open) .account (key1.pub) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); + .build (); nano::publish publish2{ nano::dev::network_params.network, open1 }; node.network.inbound (publish2, channel1); ASSERT_TIMELY_EQ (5s, 1, node.active.size ()); @@ -871,7 +871,7 @@ TEST (node, fork_open) .account (key1.pub) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); + .build (); nano::publish publish3{ nano::dev::network_params.network, open2 }; node.network.inbound (publish3, channel1); ASSERT_TIMELY (5s, (election = node.active.election (publish3.block->qualified_root ())) != nullptr); @@ -906,7 +906,7 @@ TEST (node, fork_open_flip) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1.process_active (send1); // We should be keeping this block @@ -917,7 +917,7 @@ TEST (node, fork_open_flip) .account (key1.pub) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); + .build (); // create a fork of block open1, this block will lose the election auto open2 = builder.make_block () @@ -926,7 +926,7 @@ TEST (node, fork_open_flip) .account (key1.pub) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); + .build (); ASSERT_FALSE (*open1 == *open2); // give block open1 to node1, manually trigger an election for open1 and ensure it is in the ledger @@ -1021,9 +1021,9 @@ TEST (node, fork_no_vote_quorum) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (block->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node1.process (*send1)); - ASSERT_EQ (nano::block_status::progress, node2.process (*send1)); - ASSERT_EQ (nano::block_status::progress, node3.process (*send1)); + ASSERT_EQ (nano::block_status::progress, node1.process (send1)); + ASSERT_EQ (nano::block_status::progress, node2.process (send1)); + ASSERT_EQ (nano::block_status::progress, node3.process (send1)); auto key2 (system.wallet (2)->deterministic_insert ()); auto send2 = nano::send_block_builder () .previous (block->hash ()) @@ -1031,7 +1031,7 @@ TEST (node, fork_no_vote_quorum) .balance ((nano::dev::constants.genesis_amount / 4) - (node1.config.receive_minimum.number () * 2)) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (block->hash ())) - .build_shared (); + .build (); nano::raw_key key3; auto transaction (system.wallet (1)->wallets.tx_begin_read ()); ASSERT_FALSE (system.wallet (1)->store.fetch (transaction, key1, key3)); @@ -1088,7 +1088,7 @@ TEST (node, DISABLED_fork_pre_confirm) .link (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); auto block3 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (node0.latest (nano::dev::genesis_key.pub)) @@ -1097,7 +1097,7 @@ TEST (node, DISABLED_fork_pre_confirm) .link (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node0.work_generate_blocking (*block2); node0.work_generate_blocking (*block3); node0.process_active (block2); @@ -1138,7 +1138,7 @@ TEST (node, DISABLED_fork_stale) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send3); node1.process_active (send3); system2.deadline_set (10s); @@ -1155,7 +1155,7 @@ TEST (node, DISABLED_fork_stale) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send1); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) @@ -1165,13 +1165,13 @@ TEST (node, DISABLED_fork_stale) .link (key2.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*send2); { auto transaction1 (node1.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction1, *send1)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction1, send1)); auto transaction2 (node2.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node2.ledger.process (transaction2, *send2)); + ASSERT_EQ (nano::block_status::progress, node2.ledger.process (transaction2, send2)); } node1.process_active (send1); node1.process_active (send2); @@ -1208,48 +1208,48 @@ TEST (node, DISABLED_broadcast_elected) auto transaction0 (node0->store.tx_begin_write ()); auto transaction1 (node1->store.tx_begin_write ()); auto transaction2 (node2->store.tx_begin_write ()); - auto fund_big = *builder.send () - .previous (nano::dev::genesis->hash ()) - .destination (rep_big.pub) - .balance (nano::Gxrb_ratio * 5) - .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .work (*system.work.generate (nano::dev::genesis->hash ())) - .build (); - auto open_big = *builder.open () - .source (fund_big.hash ()) - .representative (rep_big.pub) - .account (rep_big.pub) - .sign (rep_big.prv, rep_big.pub) - .work (*system.work.generate (rep_big.pub)) - .build (); - auto fund_small = *builder.send () - .previous (fund_big.hash ()) - .destination (rep_small.pub) - .balance (nano::Gxrb_ratio * 2) - .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .work (*system.work.generate (fund_big.hash ())) - .build (); - auto open_small = *builder.open () - .source (fund_small.hash ()) - .representative (rep_small.pub) - .account (rep_small.pub) - .sign (rep_small.prv, rep_small.pub) - .work (*system.work.generate (rep_small.pub)) - .build (); - auto fund_other = *builder.send () - .previous (fund_small.hash ()) - .destination (rep_other.pub) - .balance (nano::Gxrb_ratio) - .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .work (*system.work.generate (fund_small.hash ())) - .build (); - auto open_other = *builder.open () - .source (fund_other.hash ()) - .representative (rep_other.pub) - .account (rep_other.pub) - .sign (rep_other.prv, rep_other.pub) - .work (*system.work.generate (rep_other.pub)) - .build (); + auto fund_big = builder.send () + .previous (nano::dev::genesis->hash ()) + .destination (rep_big.pub) + .balance (nano::Gxrb_ratio * 5) + .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) + .work (*system.work.generate (nano::dev::genesis->hash ())) + .build (); + auto open_big = builder.open () + .source (fund_big->hash ()) + .representative (rep_big.pub) + .account (rep_big.pub) + .sign (rep_big.prv, rep_big.pub) + .work (*system.work.generate (rep_big.pub)) + .build (); + auto fund_small = builder.send () + .previous (fund_big->hash ()) + .destination (rep_small.pub) + .balance (nano::Gxrb_ratio * 2) + .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) + .work (*system.work.generate (fund_big->hash ())) + .build (); + auto open_small = builder.open () + .source (fund_small->hash ()) + .representative (rep_small.pub) + .account (rep_small.pub) + .sign (rep_small.prv, rep_small.pub) + .work (*system.work.generate (rep_small.pub)) + .build (); + auto fund_other = builder.send () + .previous (fund_small->hash ()) + .destination (rep_other.pub) + .balance (nano::Gxrb_ratio) + .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) + .work (*system.work.generate (fund_small->hash ())) + .build (); + auto open_other = builder.open () + .source (fund_other->hash ()) + .representative (rep_other.pub) + .account (rep_other.pub) + .sign (rep_other.prv, rep_other.pub) + .work (*system.work.generate (rep_other.pub)) + .build (); ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction0, fund_big)); ASSERT_EQ (nano::block_status::progress, node1->ledger.process (transaction1, fund_big)); ASSERT_EQ (nano::block_status::progress, node2->ledger.process (transaction2, fund_big)); @@ -1290,7 +1290,7 @@ TEST (node, DISABLED_broadcast_elected) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (node2->latest (nano::dev::genesis_key.pub))) - .build_shared (); + .build (); // A copy is necessary to avoid data races during ledger processing, which sets the sideband auto fork0_copy (std::make_shared (*fork0)); node0->process_active (fork0); @@ -1301,7 +1301,7 @@ TEST (node, DISABLED_broadcast_elected) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (node2->latest (nano::dev::genesis_key.pub))) - .build_shared (); + .build (); system.wallet (2)->insert_adhoc (rep_small.prv); node2->process_active (fork1); ASSERT_TIMELY (10s, node0->ledger.block_or_pruned_exists (fork0->hash ()) && node1->ledger.block_or_pruned_exists (fork0->hash ())); @@ -1325,39 +1325,39 @@ TEST (node, rep_self_vote) auto node0 = system.add_node (node_config); nano::keypair rep_big; nano::block_builder builder; - auto fund_big = *builder.send () - .previous (nano::dev::genesis->hash ()) - .destination (rep_big.pub) - .balance (nano::uint128_t{ "0xb0000000000000000000000000000000" }) - .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .work (*system.work.generate (nano::dev::genesis->hash ())) - .build (); - auto open_big = *builder.open () - .source (fund_big.hash ()) - .representative (rep_big.pub) - .account (rep_big.pub) - .sign (rep_big.prv, rep_big.pub) - .work (*system.work.generate (rep_big.pub)) - .build (); + auto fund_big = builder.send () + .previous (nano::dev::genesis->hash ()) + .destination (rep_big.pub) + .balance (nano::uint128_t{ "0xb0000000000000000000000000000000" }) + .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) + .work (*system.work.generate (nano::dev::genesis->hash ())) + .build (); + auto open_big = builder.open () + .source (fund_big->hash ()) + .representative (rep_big.pub) + .account (rep_big.pub) + .sign (rep_big.prv, rep_big.pub) + .work (*system.work.generate (rep_big.pub)) + .build (); ASSERT_EQ (nano::block_status::progress, node0->process (fund_big)); ASSERT_EQ (nano::block_status::progress, node0->process (open_big)); // Confirm both blocks, allowing voting on the upcoming block - node0->start_election (node0->block (open_big.hash ())); + node0->start_election (node0->block (open_big->hash ())); std::shared_ptr election; - ASSERT_TIMELY (5s, election = node0->active.election (open_big.qualified_root ())); + ASSERT_TIMELY (5s, election = node0->active.election (open_big->qualified_root ())); election->force_confirm (); system.wallet (0)->insert_adhoc (rep_big.prv); system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); ASSERT_EQ (system.wallet (0)->wallets.reps ().voting, 2); auto block0 = builder.send () - .previous (fund_big.hash ()) + .previous (fund_big->hash ()) .destination (rep_big.pub) .balance (nano::uint128_t ("0x60000000000000000000000000000000")) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .work (*system.work.generate (fund_big.hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node0->process (*block0)); + .work (*system.work.generate (fund_big->hash ())) + .build (); + ASSERT_EQ (nano::block_status::progress, node0->process (block0)); auto & active = node0->active; auto & scheduler = node0->scheduler; scheduler.priority.activate (nano::dev::genesis_key.pub, node0->store.tx_begin_read ()); @@ -1391,7 +1391,7 @@ TEST (node, DISABLED_bootstrap_no_publish) .build (); { auto transaction (node0->store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, *send0)); + ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, send0)); } ASSERT_FALSE (node1->bootstrap_initiator.in_progress ()); node1->bootstrap_initiator.bootstrap (node0->network.endpoint (), false); @@ -1431,8 +1431,8 @@ TEST (node, DISABLED_bootstrap_bulk_push) .balance (500) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node0->process (*send0)); + .build (); + ASSERT_EQ (nano::block_status::progress, node0->process (send0)); ASSERT_FALSE (node0->bootstrap_initiator.in_progress ()); ASSERT_FALSE (node1->bootstrap_initiator.in_progress ()); @@ -1463,27 +1463,27 @@ TEST (node, bootstrap_fork_open) auto node1 = system.add_node (node_config); nano::keypair key0; nano::block_builder builder; - auto send0 = *builder.send () - .previous (nano::dev::genesis->hash ()) - .destination (key0.pub) - .balance (nano::dev::constants.genesis_amount - 500) - .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .work (*system.work.generate (nano::dev::genesis->hash ())) - .build (); - auto open0 = *builder.open () - .source (send0.hash ()) - .representative (1) - .account (key0.pub) - .sign (key0.prv, key0.pub) - .work (*system.work.generate (key0.pub)) - .build (); - auto open1 = *builder.open () - .source (send0.hash ()) - .representative (2) - .account (key0.pub) - .sign (key0.prv, key0.pub) - .work (*system.work.generate (key0.pub)) - .build (); + auto send0 = builder.send () + .previous (nano::dev::genesis->hash ()) + .destination (key0.pub) + .balance (nano::dev::constants.genesis_amount - 500) + .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) + .work (*system.work.generate (nano::dev::genesis->hash ())) + .build (); + auto open0 = builder.open () + .source (send0->hash ()) + .representative (1) + .account (key0.pub) + .sign (key0.prv, key0.pub) + .work (*system.work.generate (key0.pub)) + .build (); + auto open1 = builder.open () + .source (send0->hash ()) + .representative (2) + .account (key0.pub) + .sign (key0.prv, key0.pub) + .work (*system.work.generate (key0.pub)) + .build (); // Both know about send0 ASSERT_EQ (nano::block_status::progress, node0->process (send0)); ASSERT_EQ (nano::block_status::progress, node1->process (send0)); @@ -1491,22 +1491,22 @@ TEST (node, bootstrap_fork_open) for (auto node : system.nodes) { node->start_election (node->block (node->latest (nano::dev::genesis_key.pub))); - ASSERT_TIMELY (1s, node->active.election (send0.qualified_root ())); - auto election = node->active.election (send0.qualified_root ()); + ASSERT_TIMELY (1s, node->active.election (send0->qualified_root ())); + auto election = node->active.election (send0->qualified_root ()); ASSERT_NE (nullptr, election); election->force_confirm (); ASSERT_TIMELY (2s, node->active.empty ()); } - ASSERT_TIMELY (3s, node0->block_confirmed (send0.hash ())); + ASSERT_TIMELY (3s, node0->block_confirmed (send0->hash ())); // They disagree about open0/open1 ASSERT_EQ (nano::block_status::progress, node0->process (open0)); ASSERT_EQ (nano::block_status::progress, node1->process (open1)); system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); - ASSERT_FALSE (node1->ledger.block_or_pruned_exists (open0.hash ())); + ASSERT_FALSE (node1->ledger.block_or_pruned_exists (open0->hash ())); ASSERT_FALSE (node1->bootstrap_initiator.in_progress ()); node1->bootstrap_initiator.bootstrap (node0->network.endpoint (), false); ASSERT_TIMELY (1s, node1->active.empty ()); - ASSERT_TIMELY (10s, !node1->ledger.block_or_pruned_exists (open1.hash ()) && node1->ledger.block_or_pruned_exists (open0.hash ())); + ASSERT_TIMELY (10s, !node1->ledger.block_or_pruned_exists (open1->hash ()) && node1->ledger.block_or_pruned_exists (open0->hash ())); } // Unconfirmed blocks from bootstrap should be confirmed @@ -1527,8 +1527,8 @@ TEST (node, bootstrap_confirm_frontiers) .balance (nano::dev::constants.genesis_amount - 500) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node0->process (*send0)); + .build (); + ASSERT_EQ (nano::block_status::progress, node0->process (send0)); // each system only has one node, so there should be no bootstrapping going on ASSERT_FALSE (node0->bootstrap_initiator.in_progress ()); @@ -1585,8 +1585,8 @@ TEST (node, unconfirmed_send) .link (nano::dev::genesis->account ()) .sign (key2.prv, key2.pub) .work (*system.work.generate (recv1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node2.process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node2.process (send2)); auto send3 = wallet2->send_action (key2.pub, nano::dev::genesis->account (), nano::Mxrb_ratio); ASSERT_TIMELY (5s, node2.block_confirmed (send2->hash ())); @@ -1686,10 +1686,10 @@ TEST (node, rep_weight) .build (); { auto transaction = node.store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, *block1)); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, *block2)); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, *block3)); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, *block4)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, block1)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, block2)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, block3)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, block4)); } ASSERT_TRUE (node.rep_crawler.representatives (1).empty ()); std::shared_ptr channel1 = nano::test::establish_tcp (system, node, node1.network.endpoint ()); @@ -1776,10 +1776,10 @@ TEST (node, rep_remove) .build (); { auto transaction = searching_node.store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, searching_node.ledger.process (transaction, *send_to_rep1)); - ASSERT_EQ (nano::block_status::progress, searching_node.ledger.process (transaction, *receive_rep1)); - ASSERT_EQ (nano::block_status::progress, searching_node.ledger.process (transaction, *send_to_rep2)); - ASSERT_EQ (nano::block_status::progress, searching_node.ledger.process (transaction, *receive_rep2)); + ASSERT_EQ (nano::block_status::progress, searching_node.ledger.process (transaction, send_to_rep1)); + ASSERT_EQ (nano::block_status::progress, searching_node.ledger.process (transaction, receive_rep1)); + ASSERT_EQ (nano::block_status::progress, searching_node.ledger.process (transaction, send_to_rep2)); + ASSERT_EQ (nano::block_status::progress, searching_node.ledger.process (transaction, receive_rep2)); } // Create channel for Rep1 @@ -2052,7 +2052,7 @@ TEST (node, online_reps_election) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1.process_active (send1); ASSERT_TIMELY_EQ (5s, 1, node1.active.size ()); // Process vote for ongoing election @@ -2080,11 +2080,11 @@ TEST (node, block_confirm) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // A copy is necessary to avoid data races during ledger processing, which sets the sideband auto send1_copy = builder.make_block () .from (*send1) - .build_shared (); + .build (); auto hash1 = send1->hash (); auto hash2 = send1_copy->hash (); node1.block_processor.add (send1); @@ -2114,8 +2114,8 @@ TEST (node, confirm_quorum) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1.process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1.process (send1)); system.wallet (0)->send_action (nano::dev::genesis_key.pub, nano::dev::genesis_key.pub, new_balance.number ()); ASSERT_TIMELY (2s, node1.active.election (send1->qualified_root ())); auto election = node1.active.election (send1->qualified_root ()); @@ -2141,7 +2141,7 @@ TEST (node, local_votes_cache) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (send1->hash ()) @@ -2150,7 +2150,7 @@ TEST (node, local_votes_cache) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (send1->hash ())) - .build_shared (); + .build (); auto send3 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (send2->hash ()) @@ -2159,11 +2159,11 @@ TEST (node, local_votes_cache) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (send2->hash ())) - .build_shared (); + .build (); { auto transaction (node.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, send2)); } // Confirm blocks to allow voting node.start_election (send2); @@ -2193,7 +2193,7 @@ TEST (node, local_votes_cache) // Max cache { auto transaction (node.store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, *send3)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (transaction, send3)); } nano::confirm_req message3{ nano::dev::network_params.network, send3->hash (), send3->root () }; for (auto i (0); i < 100; ++i) @@ -2230,8 +2230,8 @@ TEST (node, DISABLED_local_votes_cache_batch) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1)); node.confirmation_height_processor.add (send1); ASSERT_TIMELY (5s, node.ledger.block_confirmed (node.store.tx_begin_read (), send1->hash ())); auto send2 = nano::state_block_builder () @@ -2242,8 +2242,8 @@ TEST (node, DISABLED_local_votes_cache_batch) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send2)); auto receive1 = nano::state_block_builder () .account (key1.pub) .previous (0) @@ -2252,8 +2252,8 @@ TEST (node, DISABLED_local_votes_cache_batch) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*node.work_generate_blocking (key1.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *receive1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), receive1)); std::vector> batch{ { send2->hash (), send2->root () }, { receive1->hash (), receive1->root () } }; nano::confirm_req message{ nano::dev::network_params.network, batch }; auto channel = std::make_shared (node); @@ -2315,8 +2315,8 @@ TEST (node, local_votes_cache_generate_new_vote) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (send1)); // One of the hashes is cached std::vector> roots_hashes{ std::make_pair (nano::dev::genesis->hash (), nano::dev::genesis->root ()), std::make_pair (send1->hash (), send1->root ()) }; nano::confirm_req message2{ nano::dev::network_params.network, roots_hashes }; @@ -2354,7 +2354,7 @@ TEST (node, local_votes_cache_fork) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send1_fork = nano::state_block_builder () .account (nano::dev::genesis_key.pub) .previous (nano::dev::genesis->hash ()) @@ -2363,8 +2363,8 @@ TEST (node, local_votes_cache_fork) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1.process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1.process (send1)); // Cache vote auto vote = nano::test::make_vote (nano::dev::genesis_key, { send1 }, 0, 0); node1.vote_processor.vote (vote, std::make_shared (node1)); @@ -2396,14 +2396,14 @@ TEST (node, vote_republish) .balance (std::numeric_limits::max () - node1.config.receive_minimum.number ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .previous (nano::dev::genesis->hash ()) .destination (key2.pub) .balance (std::numeric_limits::max () - node1.config.receive_minimum.number () * 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // process send1 first, this will make sure send1 goes into the ledger and an election is started node1.process_active (send1); @@ -2454,9 +2454,9 @@ TEST (node, vote_by_hash_bundle) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); blocks.push_back (block); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *blocks.back ())); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), blocks.back ())); for (auto i = 2; i < 200; ++i) { auto block = builder.make_block () @@ -2465,9 +2465,9 @@ TEST (node, vote_by_hash_bundle) .balance (nano::dev::constants.genesis_amount - i) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (blocks.back ()->hash ())) - .build_shared (); + .build (); blocks.push_back (block); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *blocks.back ())); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), blocks.back ())); } // Confirming last block will confirm whole chain and allow us to generate votes for those blocks later @@ -2514,14 +2514,14 @@ TEST (node, vote_by_hash_republish) .balance (std::numeric_limits::max () - node1.config.receive_minimum.number ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .previous (nano::dev::genesis->hash ()) .destination (key2.pub) .balance (std::numeric_limits::max () - node1.config.receive_minimum.number () * 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // give block send1 to node1 and check that an election for send1 starts on both nodes node1.process_active (send1); @@ -2564,7 +2564,7 @@ TEST (node, DISABLED_vote_by_hash_epoch_block_republish) .balance (std::numeric_limits::max () - node1.config.receive_minimum.number ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto epoch1 = nano::state_block_builder () .account (nano::dev::genesis->account ()) .previous (nano::dev::genesis->hash ()) @@ -2573,7 +2573,7 @@ TEST (node, DISABLED_vote_by_hash_epoch_block_republish) .link (node1.ledger.epoch_link (nano::epoch::epoch_1)) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1.process_active (send1); ASSERT_TIMELY (5s, node2.active.active (*send1)); node1.active.publish (epoch1); @@ -2608,7 +2608,7 @@ TEST (node, epoch_conflict_confirm) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto open = builder.make_block () .account (key.pub) .previous (0) @@ -2617,7 +2617,7 @@ TEST (node, epoch_conflict_confirm) .link (send->hash ()) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); auto change = builder.make_block () .account (key.pub) .previous (open->hash ()) @@ -2626,7 +2626,7 @@ TEST (node, epoch_conflict_confirm) .link (0) .sign (key.prv, key.pub) .work (*system.work.generate (open->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (send->hash ()) @@ -2635,7 +2635,7 @@ TEST (node, epoch_conflict_confirm) .link (open->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send->hash ())) - .build_shared (); + .build (); auto epoch_open = builder.make_block () .account (change->root ().as_account ()) .previous (0) @@ -2644,7 +2644,7 @@ TEST (node, epoch_conflict_confirm) .link (node0.ledger.epoch_link (nano::epoch::epoch_1)) .sign (epoch_signer.prv, epoch_signer.pub) .work (*system.work.generate (open->hash ())) - .build_shared (); + .build (); // Process initial blocks on node1 ASSERT_TRUE (nano::test::process (node1, { send, send2, open })); @@ -2704,14 +2704,14 @@ TEST (node, DISABLED_fork_invalid_block_signature) .balance (std::numeric_limits::max () - node1.config.receive_minimum.number ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .previous (nano::dev::genesis->hash ()) .destination (key2.pub) .balance (std::numeric_limits::max () - node1.config.receive_minimum.number () * 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2_corrupt (std::make_shared (*send2)); send2_corrupt->signature = nano::signature (123); auto vote = nano::test::make_vote (nano::dev::genesis_key, { send2 }, 0, 0); @@ -2743,7 +2743,7 @@ TEST (node, fork_election_invalid_block_signature) .link (nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .build_shared (); + .build (); auto send2 = builder.state () .account (nano::dev::genesis_key.pub) .previous (nano::dev::genesis->hash ()) @@ -2752,7 +2752,7 @@ TEST (node, fork_election_invalid_block_signature) .link (nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .build_shared (); + .build (); auto send3 = builder.state () .account (nano::dev::genesis_key.pub) .previous (nano::dev::genesis->hash ()) @@ -2761,7 +2761,7 @@ TEST (node, fork_election_invalid_block_signature) .link (nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .sign (nano::dev::genesis_key.prv, 0) // Invalid signature - .build_shared (); + .build (); auto channel1 = std::make_shared (node1); node1.network.inbound (nano::publish{ nano::dev::network_params.network, send1 }, channel1); @@ -2793,7 +2793,7 @@ TEST (node, block_processor_signatures) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (latest)) - .build_shared (); + .build (); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (send1->hash ()) @@ -2802,7 +2802,7 @@ TEST (node, block_processor_signatures) .link (key2.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (send1->hash ())) - .build_shared (); + .build (); auto send3 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (send2->hash ()) @@ -2811,7 +2811,7 @@ TEST (node, block_processor_signatures) .link (key3.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (send2->hash ())) - .build_shared (); + .build (); // Invalid signature bit auto send4 = builder.make_block () .account (nano::dev::genesis_key.pub) @@ -2821,7 +2821,7 @@ TEST (node, block_processor_signatures) .link (key3.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (send3->hash ())) - .build_shared (); + .build (); send4->signature.bytes[32] ^= 0x1; // Invalid signature bit (force) auto send5 = builder.make_block () @@ -2832,7 +2832,7 @@ TEST (node, block_processor_signatures) .link (key3.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (send3->hash ())) - .build_shared (); + .build (); send5->signature.bytes[32] ^= 0x1; // Invalid signature to unchecked node1.unchecked.put (send5->previous (), nano::unchecked_info{ send5 }); @@ -2844,7 +2844,7 @@ TEST (node, block_processor_signatures) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*node1.work_generate_blocking (key1.pub)) - .build_shared (); + .build (); auto receive2 = builder.make_block () .account (key2.pub) .previous (0) @@ -2853,7 +2853,7 @@ TEST (node, block_processor_signatures) .link (send2->hash ()) .sign (key2.prv, key2.pub) .work (*node1.work_generate_blocking (key2.pub)) - .build_shared (); + .build (); // Invalid private key auto receive3 = builder.make_block () .account (key3.pub) @@ -2863,7 +2863,7 @@ TEST (node, block_processor_signatures) .link (send3->hash ()) .sign (key2.prv, key3.pub) .work (*node1.work_generate_blocking (key3.pub)) - .build_shared (); + .build (); node1.process_active (send1); node1.process_active (send2); node1.process_active (send3); @@ -2895,7 +2895,7 @@ TEST (node, block_processor_reject_state) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); send1->signature.bytes[0] ^= 1; ASSERT_FALSE (node.ledger.block_or_pruned_exists (send1->hash ())); node.process_active (send1); @@ -2909,7 +2909,7 @@ TEST (node, block_processor_reject_state) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node.process_active (send2); ASSERT_TIMELY (5s, node.ledger.block_or_pruned_exists (send2->hash ())); } @@ -2930,7 +2930,7 @@ TEST (node, block_processor_full) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (nano::dev::genesis->hash ()) @@ -2939,7 +2939,7 @@ TEST (node, block_processor_full) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send3 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (nano::dev::genesis->hash ()) @@ -2948,7 +2948,7 @@ TEST (node, block_processor_full) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node.block_processor.stop (); // Stop processing the block queue node.block_processor.add (send1); ASSERT_FALSE (node.block_processor.full ()); @@ -2975,7 +2975,7 @@ TEST (node, block_processor_half_full) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (send1->hash ()) @@ -2984,7 +2984,7 @@ TEST (node, block_processor_half_full) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (send1->hash ())) - .build_shared (); + .build (); auto send3 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (send2->hash ()) @@ -2993,7 +2993,7 @@ TEST (node, block_processor_half_full) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (send2->hash ())) - .build_shared (); + .build (); // The write guard prevents block processor doing any writes auto write_guard = node.write_database_queue.wait (nano::writer::testing); node.block_processor.add (send1); @@ -3018,7 +3018,7 @@ TEST (node, confirm_back) .balance (genesis_start_balance - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); nano::state_block_builder builder; auto open = builder.make_block () .account (key.pub) @@ -3028,7 +3028,7 @@ TEST (node, confirm_back) .link (send1->hash ()) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); auto send2 = builder.make_block () .account (key.pub) .previous (open->hash ()) @@ -3037,7 +3037,7 @@ TEST (node, confirm_back) .link (nano::dev::genesis_key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (open->hash ())) - .build_shared (); + .build (); node.process_active (send1); node.process_active (open); node.process_active (send2); @@ -3221,7 +3221,7 @@ TEST (node, bidirectional_tcp) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1->process_active (send1); ASSERT_TIMELY (10s, node1->ledger.block_or_pruned_exists (send1->hash ()) && node2->ledger.block_or_pruned_exists (send1->hash ())); // Test block confirmation from node 1 (add representative to node 1) @@ -3254,7 +3254,7 @@ TEST (node, bidirectional_tcp) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (send1->hash ())) - .build_shared (); + .build (); node2->process_active (send2); ASSERT_TIMELY (10s, node1->ledger.block_or_pruned_exists (send2->hash ()) && node2->ledger.block_or_pruned_exists (send2->hash ())); // Test block confirmation from node 2 (add representative to node 2) @@ -3305,7 +3305,7 @@ TEST (node, rollback_vote_self) .balance (nano::dev::constants.genesis_amount - (nano::dev::constants.genesis_amount / 2)) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto open = builder.make_block () .account (key.pub) @@ -3315,7 +3315,7 @@ TEST (node, rollback_vote_self) .balance (nano::dev::constants.genesis_amount / 2) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); // send 1 raw auto send2 = builder.make_block () @@ -3325,14 +3325,14 @@ TEST (node, rollback_vote_self) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); // fork of send2 block auto fork = builder.make_block () .from (*send2) .balance (send1->balance ().number () - 2) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) - .build_shared (); + .build (); // Process and mark the first 2 blocks as confirmed to allow voting ASSERT_TRUE (nano::test::process (node, { send1, open })); @@ -3403,7 +3403,7 @@ TEST (node, rollback_gap_source) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // Side a of a forked open block receiving from send1 // This is a losing block auto fork1a = builder.make_block () @@ -3414,7 +3414,7 @@ TEST (node, rollback_gap_source) .balance (1) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); auto send2 = builder.make_block () .from (*send1) .previous (send1->hash ()) @@ -3422,17 +3422,17 @@ TEST (node, rollback_gap_source) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); // Side b of a forked open block receiving from send2. // This is the winning block auto fork1b = builder.make_block () .from (*fork1a) .link (send2->hash ()) .sign (key.prv, key.pub) - .build_shared (); + .build (); // Set 'node' up with losing block 'fork1a' - ASSERT_EQ (nano::block_status::progress, node.process (*send1)); - ASSERT_EQ (nano::block_status::progress, node.process (*fork1a)); + ASSERT_EQ (nano::block_status::progress, node.process (send1)); + ASSERT_EQ (nano::block_status::progress, node.process (fork1a)); // Node has 'fork1a' & doesn't have source 'send2' for winning 'fork1b' block ASSERT_EQ (nullptr, node.block (send2->hash ())); node.block_processor.force (fork1b); @@ -3445,7 +3445,7 @@ TEST (node, rollback_gap_source) node.process_active (fork1a); ASSERT_TIMELY (5s, node.block (fork1a->hash ()) != nullptr); // With send2 block in ledger election can start again to remove fork block - ASSERT_EQ (nano::block_status::progress, node.process (*send2)); + ASSERT_EQ (nano::block_status::progress, node.process (send2)); node.block_processor.force (fork1b); // Wait for new rollback ASSERT_TIMELY_EQ (5s, node.stats.count (nano::stat::type::rollback, nano::stat::detail::open), 2); @@ -3474,7 +3474,7 @@ TEST (node, dependency_graph) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // Receive from genesis auto key1_open = builder.make_block () .account (key1.pub) @@ -3589,19 +3589,19 @@ TEST (node, dependency_graph) .work (*system.work.generate (key3_receive->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node.process (*gen_send1)); - ASSERT_EQ (nano::block_status::progress, node.process (*key1_open)); - ASSERT_EQ (nano::block_status::progress, node.process (*key1_send1)); - ASSERT_EQ (nano::block_status::progress, node.process (*gen_receive)); - ASSERT_EQ (nano::block_status::progress, node.process (*gen_send2)); - ASSERT_EQ (nano::block_status::progress, node.process (*key2_open)); - ASSERT_EQ (nano::block_status::progress, node.process (*key2_send1)); - ASSERT_EQ (nano::block_status::progress, node.process (*key3_open)); - ASSERT_EQ (nano::block_status::progress, node.process (*key2_send2)); - ASSERT_EQ (nano::block_status::progress, node.process (*key1_receive)); - ASSERT_EQ (nano::block_status::progress, node.process (*key1_send2)); - ASSERT_EQ (nano::block_status::progress, node.process (*key3_receive)); - ASSERT_EQ (nano::block_status::progress, node.process (*key3_epoch)); + ASSERT_EQ (nano::block_status::progress, node.process (gen_send1)); + ASSERT_EQ (nano::block_status::progress, node.process (key1_open)); + ASSERT_EQ (nano::block_status::progress, node.process (key1_send1)); + ASSERT_EQ (nano::block_status::progress, node.process (gen_receive)); + ASSERT_EQ (nano::block_status::progress, node.process (gen_send2)); + ASSERT_EQ (nano::block_status::progress, node.process (key2_open)); + ASSERT_EQ (nano::block_status::progress, node.process (key2_send1)); + ASSERT_EQ (nano::block_status::progress, node.process (key3_open)); + ASSERT_EQ (nano::block_status::progress, node.process (key2_send2)); + ASSERT_EQ (nano::block_status::progress, node.process (key1_receive)); + ASSERT_EQ (nano::block_status::progress, node.process (key1_send2)); + ASSERT_EQ (nano::block_status::progress, node.process (key3_receive)); + ASSERT_EQ (nano::block_status::progress, node.process (key3_epoch)); ASSERT_TRUE (node.active.empty ()); // Hash -> Ancestors @@ -3675,7 +3675,7 @@ TEST (node, dependency_graph_frontier) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); // Receive from genesis auto key1_open = builder.make_block () .account (key1.pub) @@ -3793,19 +3793,19 @@ TEST (node, dependency_graph_frontier) for (auto const & node : system.nodes) { auto transaction (node->store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *gen_send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *key1_open)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *key1_send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *gen_receive)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *gen_send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *key2_open)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *key2_send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *key3_open)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *key2_send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *key1_receive)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *key1_send2)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *key3_receive)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *key3_epoch)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, gen_send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, key1_open)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, key1_send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, gen_receive)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, gen_send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, key2_open)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, key2_send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, key3_open)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, key2_send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, key1_receive)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, key1_send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, key3_receive)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, key3_epoch)); } // node1 can vote, but only on the first block @@ -3842,7 +3842,7 @@ TEST (node, deferred_dependent_elections) .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto open = builder.make_block () .account (key.pub) .previous (0) @@ -3851,7 +3851,7 @@ TEST (node, deferred_dependent_elections) .balance (1) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); auto send2 = builder.make_block () .from (*send1) .previous (send1->hash ()) @@ -3859,7 +3859,7 @@ TEST (node, deferred_dependent_elections) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); auto receive = builder.make_block () .from (*open) .previous (open->hash ()) @@ -3867,12 +3867,12 @@ TEST (node, deferred_dependent_elections) .balance (2) .sign (key.prv, key.pub) .work (*system.work.generate (open->hash ())) - .build_shared (); + .build (); auto fork = builder.make_block () .from (*receive) .representative (nano::dev::genesis_key.pub) // was key.pub .sign (key.prv, key.pub) - .build_shared (); + .build (); nano::test::process (node, { send1 }); auto election_send1 = nano::test::start_election (system, node, send1->hash ()); @@ -3919,7 +3919,7 @@ TEST (node, deferred_dependent_elections) ASSERT_NE (nullptr, election_open); // Confirm one of the dependents of the receive but not the other, to ensure both have to be confirmed to start an election on processing - ASSERT_EQ (nano::block_status::progress, node.process (*receive)); + ASSERT_EQ (nano::block_status::progress, node.process (receive)); ASSERT_FALSE (node.active.active (receive->qualified_root ())); election_open->force_confirm (); ASSERT_TIMELY (5s, node.block_confirmed (open->hash ())); @@ -3932,7 +3932,7 @@ TEST (node, deferred_dependent_elections) ASSERT_NEVER (0.5s, node.active.active (receive->qualified_root ())); // Processing a fork will also not start an election - ASSERT_EQ (nano::block_status::fork, node.process (*fork)); + ASSERT_EQ (nano::block_status::fork, node.process (fork)); node.process_local (fork); ASSERT_NEVER (0.5s, node.active.active (receive->qualified_root ())); @@ -4007,7 +4007,7 @@ TEST (node, pruning_automatic) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_hash)) - .build_shared (); + .build (); node1.process_active (send1); latest_hash = send1->hash (); @@ -4017,7 +4017,7 @@ TEST (node, pruning_automatic) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_hash)) - .build_shared (); + .build (); node1.process_active (send2); ASSERT_TIMELY (5s, node1.block (send2->hash ()) != nullptr); @@ -4059,7 +4059,7 @@ TEST (node, pruning_age) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_hash)) - .build_shared (); + .build (); node1.process_active (send1); latest_hash = send1->hash (); @@ -4069,7 +4069,7 @@ TEST (node, pruning_age) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_hash)) - .build_shared (); + .build (); node1.process_active (send2); // Force-confirm both blocks @@ -4120,7 +4120,7 @@ TEST (node, pruning_depth) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_hash)) - .build_shared (); + .build (); node1.process_active (send1); latest_hash = send1->hash (); @@ -4130,7 +4130,7 @@ TEST (node, pruning_depth) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_hash)) - .build_shared (); + .build (); node1.process_active (send2); // Force-confirm both blocks diff --git a/nano/core_test/processor_service.cpp b/nano/core_test/processor_service.cpp index d4fc701452..9a9f33b10d 100644 --- a/nano/core_test/processor_service.cpp +++ b/nano/core_test/processor_service.cpp @@ -32,7 +32,7 @@ TEST (processor_service, bad_send_signature) .work (*pool.generate (info1->head)) .build (); send->signature.bytes[32] ^= 0x1; - ASSERT_EQ (nano::block_status::bad_signature, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::bad_signature, ledger.process (transaction, send)); } TEST (processor_service, bad_receive_signature) @@ -57,7 +57,7 @@ TEST (processor_service, bad_receive_signature) .work (*pool.generate (info1->head)) .build (); nano::block_hash hash1 (send->hash ()); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); auto info2 = ledger.account_info (transaction, nano::dev::genesis_key.pub); ASSERT_TRUE (info2); auto receive = builder @@ -68,5 +68,5 @@ TEST (processor_service, bad_receive_signature) .work (*pool.generate (hash1)) .build (); receive->signature.bytes[32] ^= 0x1; - ASSERT_EQ (nano::block_status::bad_signature, ledger.process (transaction, *receive)); + ASSERT_EQ (nano::block_status::bad_signature, ledger.process (transaction, receive)); } diff --git a/nano/core_test/request_aggregator.cpp b/nano/core_test/request_aggregator.cpp index 93b3edc5b4..dff3215527 100644 --- a/nano/core_test/request_aggregator.cpp +++ b/nano/core_test/request_aggregator.cpp @@ -26,7 +26,7 @@ TEST (request_aggregator, one) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); std::vector> request; request.emplace_back (send1->hash (), send1->root ()); auto client = std::make_shared (node); @@ -36,7 +36,7 @@ TEST (request_aggregator, one) ASSERT_TIMELY (3s, node.aggregator.empty ()); // Not yet in the ledger ASSERT_TIMELY_EQ (3s, 1, node.stats.count (nano::stat::type::requests, nano::stat::detail::requests_unknown)); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send1)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1)); node.aggregator.add (dummy_channel, request); ASSERT_EQ (1, node.aggregator.size ()); // In the ledger but no vote generated yet @@ -72,8 +72,8 @@ TEST (request_aggregator, one_update) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1)); node.confirmation_height_processor.add (send1); ASSERT_TIMELY (5s, node.ledger.block_confirmed (node.store.tx_begin_read (), send1->hash ())); auto send2 = nano::state_block_builder () @@ -84,8 +84,8 @@ TEST (request_aggregator, one_update) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send2)); auto receive1 = nano::state_block_builder () .account (key1.pub) .previous (0) @@ -94,8 +94,8 @@ TEST (request_aggregator, one_update) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*node.work_generate_blocking (key1.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *receive1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), receive1)); std::vector> request; request.emplace_back (send2->hash (), send2->root ()); auto client = std::make_shared (node); @@ -138,8 +138,8 @@ TEST (request_aggregator, two) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1)); node.confirmation_height_processor.add (send1); ASSERT_TIMELY (5s, node.ledger.block_confirmed (node.store.tx_begin_read (), send1->hash ())); auto send2 = builder.make_block () @@ -150,7 +150,7 @@ TEST (request_aggregator, two) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (send1->hash ())) - .build_shared (); + .build (); auto receive1 = builder.make_block () .account (key1.pub) .previous (0) @@ -159,9 +159,9 @@ TEST (request_aggregator, two) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*node.work_generate_blocking (key1.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send2)); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *receive1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send2)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), receive1)); std::vector> request; request.emplace_back (send2->hash (), send2->root ()); request.emplace_back (receive1->hash (), receive1->root ()); @@ -215,10 +215,10 @@ TEST (request_aggregator, two_endpoints) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); std::vector> request; request.emplace_back (send1->hash (), send1->root ()); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (node1.store.tx_begin_write (), *send1)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (node1.store.tx_begin_write (), send1)); auto dummy_channel1 = std::make_shared (node1, node1); auto dummy_channel2 = std::make_shared (node2, node2); ASSERT_NE (nano::transport::map_endpoint_to_v6 (dummy_channel1->get_endpoint ()), nano::transport::map_endpoint_to_v6 (dummy_channel2->get_endpoint ())); @@ -279,7 +279,7 @@ TEST (request_aggregator, split) .build ()); auto const & block = blocks.back (); previous = block->hash (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *block)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), block)); request.emplace_back (block->hash (), block->root ()); } // Confirm all blocks @@ -324,8 +324,8 @@ TEST (request_aggregator, channel_lifetime) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1)); std::vector> request; request.emplace_back (send1->hash (), send1->root ()); { @@ -355,8 +355,8 @@ TEST (request_aggregator, channel_update) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1)); std::vector> request; request.emplace_back (send1->hash (), send1->root ()); std::weak_ptr channel1_w; @@ -395,8 +395,8 @@ TEST (request_aggregator, channel_max_queue) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1)); std::vector> request; request.emplace_back (send1->hash (), send1->root ()); auto client = std::make_shared (node); @@ -423,8 +423,8 @@ TEST (request_aggregator, unique) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node.work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1)); std::vector> request; request.emplace_back (send1->hash (), send1->root ()); auto client = std::make_shared (node); @@ -456,16 +456,16 @@ TEST (request_aggregator, cannot_vote) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .from (*send1) .previous (send1->hash ()) .balance (send1->balance ().number () - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.process (*send1)); - ASSERT_EQ (nano::block_status::progress, node.process (*send2)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.process (send1)); + ASSERT_EQ (nano::block_status::progress, node.process (send2)); system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); ASSERT_FALSE (node.ledger.dependents_confirmed (node.store.tx_begin_read (), *send2)); diff --git a/nano/core_test/scheduler_buckets.cpp b/nano/core_test/scheduler_buckets.cpp index 0a9c6adfba..0b3aff2381 100644 --- a/nano/core_test/scheduler_buckets.cpp +++ b/nano/core_test/scheduler_buckets.cpp @@ -42,7 +42,7 @@ std::shared_ptr & blockzero () .link (0) .sign (keyzero ().prv, keyzero ().pub) .work (0) - .build_shared (); + .build (); return result; } std::shared_ptr & block0 () @@ -57,7 +57,7 @@ std::shared_ptr & block0 () .link (0) .sign (key0 ().prv, key0 ().pub) .work (0) - .build_shared (); + .build (); return result; } std::shared_ptr & block1 () @@ -72,7 +72,7 @@ std::shared_ptr & block1 () .link (0) .sign (key1 ().prv, key1 ().pub) .work (0) - .build_shared (); + .build (); return result; } std::shared_ptr & block2 () @@ -87,7 +87,7 @@ std::shared_ptr & block2 () .link (0) .sign (key2 ().prv, key2 ().pub) .work (0) - .build_shared (); + .build (); return result; } std::shared_ptr & block3 () @@ -102,7 +102,7 @@ std::shared_ptr & block3 () .link (0) .sign (key3 ().prv, key3 ().pub) .work (0) - .build_shared (); + .build (); return result; } diff --git a/nano/core_test/system.cpp b/nano/core_test/system.cpp index e40916700b..8ac65cc76b 100644 --- a/nano/core_test/system.cpp +++ b/nano/core_test/system.cpp @@ -58,9 +58,9 @@ TEST (system, DISABLED_generate_send_existing) .account (stake_preserver.pub) .sign (stake_preserver.prv, stake_preserver.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*open_block); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *open_block)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, open_block)); } ASSERT_GT (node1.balance (stake_preserver.pub), node1.balance (nano::dev::genesis->account ())); auto info2 = node1.ledger.account_info (node1.store.tx_begin_read (), nano::dev::genesis_key.pub); @@ -109,9 +109,9 @@ TEST (system, DISABLED_generate_send_new) .account (stake_preserver.pub) .sign (stake_preserver.prv, stake_preserver.pub) .work (0) - .build_shared (); + .build (); node1.work_generate_blocking (*open_block); - ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, *open_block)); + ASSERT_EQ (nano::block_status::progress, node1.ledger.process (transaction, open_block)); } ASSERT_GT (node1.balance (stake_preserver.pub), node1.balance (nano::dev::genesis->account ())); std::vector accounts; diff --git a/nano/core_test/unchecked_map.cpp b/nano/core_test/unchecked_map.cpp index 6b3c799652..3688b6f5e0 100644 --- a/nano/core_test/unchecked_map.cpp +++ b/nano/core_test/unchecked_map.cpp @@ -37,7 +37,7 @@ std::shared_ptr block () .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); } } @@ -65,7 +65,7 @@ TEST (block_store, one_bootstrap) .balance (2) .sign (nano::keypair ().prv, 4) .work (5) - .build_shared (); + .build (); unchecked.put (block1->hash (), nano::unchecked_info{ block1 }); auto check_block_is_listed = [&] (nano::block_hash const & block_hash_a) { return unchecked.get (block_hash_a).size () > 0; @@ -98,7 +98,7 @@ TEST (unchecked, simple) .balance (2) .sign (nano::keypair ().prv, 4) .work (5) - .build_shared (); + .build (); // Asserts the block wasn't added yet to the unchecked table auto block_listing1 = unchecked.get (block->previous ()); ASSERT_TRUE (block_listing1.empty ()); @@ -139,7 +139,7 @@ TEST (unchecked, multiple) .balance (2) .sign (nano::keypair ().prv, 4) .work (5) - .build_shared (); + .build (); // Asserts the block wasn't added yet to the unchecked table auto block_listing1 = unchecked.get (block->previous ()); ASSERT_TRUE (block_listing1.empty ()); @@ -169,7 +169,7 @@ TEST (unchecked, double_put) .balance (2) .sign (nano::keypair ().prv, 4) .work (5) - .build_shared (); + .build (); // Asserts the block wasn't added yet to the unchecked table auto block_listing1 = unchecked.get (block->previous ()); ASSERT_TRUE (block_listing1.empty ()); @@ -201,7 +201,7 @@ TEST (unchecked, multiple_get) .balance (2) .sign (nano::keypair ().prv, 4) .work (5) - .build_shared (); + .build (); auto block2 = builder .send () .previous (3) @@ -209,7 +209,7 @@ TEST (unchecked, multiple_get) .balance (2) .sign (nano::keypair ().prv, 4) .work (5) - .build_shared (); + .build (); auto block3 = builder .send () .previous (5) @@ -217,7 +217,7 @@ TEST (unchecked, multiple_get) .balance (2) .sign (nano::keypair ().prv, 4) .work (5) - .build_shared (); + .build (); // Add the blocks' info to the unchecked table unchecked.put (block1->previous (), nano::unchecked_info (block1)); // unchecked1 unchecked.put (block1->hash (), nano::unchecked_info (block1)); // unchecked2 diff --git a/nano/core_test/voting.cpp b/nano/core_test/voting.cpp index d43f1d3830..cc95dd8461 100644 --- a/nano/core_test/voting.cpp +++ b/nano/core_test/voting.cpp @@ -158,7 +158,7 @@ TEST (vote_spacing, vote_generator) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (nano::dev::genesis->hash ()) @@ -167,13 +167,13 @@ TEST (vote_spacing, vote_generator) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1)); ASSERT_EQ (0, node.stats.count (nano::stat::type::vote_generator, nano::stat::detail::generator_broadcasts)); node.generator.add (nano::dev::genesis->hash (), send1->hash ()); ASSERT_TIMELY_EQ (3s, node.stats.count (nano::stat::type::vote_generator, nano::stat::detail::generator_broadcasts), 1); ASSERT_FALSE (node.ledger.rollback (node.store.tx_begin_write (), send1->hash ())); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send2)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send2)); node.generator.add (nano::dev::genesis->hash (), send2->hash ()); ASSERT_TIMELY_EQ (3s, node.stats.count (nano::stat::type::vote_generator, nano::stat::detail::generator_spacing), 1); ASSERT_EQ (1, node.stats.count (nano::stat::type::vote_generator, nano::stat::detail::generator_broadcasts)); @@ -202,7 +202,7 @@ TEST (vote_spacing, rapid) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder.make_block () .account (nano::dev::genesis_key.pub) .previous (nano::dev::genesis->hash ()) @@ -211,12 +211,12 @@ TEST (vote_spacing, rapid) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send1)); node.generator.add (nano::dev::genesis->hash (), send1->hash ()); ASSERT_TIMELY_EQ (3s, node.stats.count (nano::stat::type::vote_generator, nano::stat::detail::generator_broadcasts), 1); ASSERT_FALSE (node.ledger.rollback (node.store.tx_begin_write (), send1->hash ())); - ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), *send2)); + ASSERT_EQ (nano::block_status::progress, node.ledger.process (node.store.tx_begin_write (), send2)); node.generator.add (nano::dev::genesis->hash (), send2->hash ()); ASSERT_TIMELY_EQ (3s, node.stats.count (nano::stat::type::vote_generator, nano::stat::detail::generator_spacing), 1); ASSERT_TIMELY_EQ (3s, 1, node.stats.count (nano::stat::type::vote_generator, nano::stat::detail::generator_broadcasts)); diff --git a/nano/core_test/wallet.cpp b/nano/core_test/wallet.cpp index c53b6c13c4..c6fec45f5f 100644 --- a/nano/core_test/wallet.cpp +++ b/nano/core_test/wallet.cpp @@ -1101,7 +1101,7 @@ TEST (wallet, epoch_2_receive_unopened) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (key.pub, node.network_params.work.epoch_2)) .build (); - ASSERT_EQ (nano::block_status::progress, node.process (*epoch2_unopened)); + ASSERT_EQ (nano::block_status::progress, node.process (epoch2_unopened)); wallet.insert_adhoc (key.prv, false); @@ -1162,7 +1162,7 @@ TEST (wallet, search_receivable) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node.process (*send)); + ASSERT_EQ (nano::block_status::progress, node.process (send)); // Pending search should start an election ASSERT_TRUE (node.active.empty ()); diff --git a/nano/core_test/wallets.cpp b/nano/core_test/wallets.cpp index 5e3d45dfb8..38009cdb19 100644 --- a/nano/core_test/wallets.cpp +++ b/nano/core_test/wallets.cpp @@ -110,7 +110,7 @@ TEST (wallets, vote_minimum) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node1.process (*send1)); + ASSERT_EQ (nano::block_status::progress, node1.process (send1)); auto open1 = builder .state () .account (key1.pub) @@ -121,7 +121,7 @@ TEST (wallets, vote_minimum) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node1.process (*open1)); + ASSERT_EQ (nano::block_status::progress, node1.process (open1)); // send2 with amount vote_minimum - 1 (not voting representative) auto send2 = builder .state () @@ -133,7 +133,7 @@ TEST (wallets, vote_minimum) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node1.process (*send2)); + ASSERT_EQ (nano::block_status::progress, node1.process (send2)); auto open2 = builder .state () .account (key2.pub) @@ -144,7 +144,7 @@ TEST (wallets, vote_minimum) .sign (key2.prv, key2.pub) .work (*system.work.generate (key2.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node1.process (*open2)); + ASSERT_EQ (nano::block_status::progress, node1.process (open2)); auto wallet (node1.wallets.items.begin ()->second); nano::unique_lock representatives_lk (wallet->representatives_mutex); ASSERT_EQ (0, wallet->representatives.size ()); @@ -212,7 +212,7 @@ TEST (wallets, search_receivable) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node.process (*send)); + ASSERT_EQ (nano::block_status::progress, node.process (send)); // Pending search should start an election ASSERT_TRUE (node.active.empty ()); diff --git a/nano/core_test/websocket.cpp b/nano/core_test/websocket.cpp index bc2fa0140b..317d999e74 100644 --- a/nano/core_test/websocket.cpp +++ b/nano/core_test/websocket.cpp @@ -99,7 +99,7 @@ TEST (websocket, confirmation) .balance (balance) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send); } @@ -118,7 +118,7 @@ TEST (websocket, confirmation) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send); } @@ -158,7 +158,7 @@ TEST (websocket, started_election) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); nano::publish publish1{ nano::dev::network_params.network, send1 }; auto channel1 = std::make_shared (*node1); node1->network.inbound (publish1, channel1); @@ -206,7 +206,7 @@ TEST (websocket, stopped_election) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); nano::publish publish1{ nano::dev::network_params.network, send1 }; auto channel1 = std::make_shared (*node1); node1->network.inbound (publish1, channel1); @@ -264,7 +264,7 @@ TEST (websocket, confirmation_options) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send); previous = send->hash (); @@ -297,7 +297,7 @@ TEST (websocket, confirmation_options) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send); previous = send->hash (); @@ -360,7 +360,7 @@ TEST (websocket, confirmation_options) .balance (balance) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send); previous = send->hash (); } @@ -406,7 +406,7 @@ TEST (websocket, confirmation_options_votes) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send); previous = send->hash (); @@ -493,7 +493,7 @@ TEST (websocket, confirmation_options_sideband) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send); previous = send->hash (); @@ -574,7 +574,7 @@ TEST (websocket, confirmation_options_update) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send); @@ -592,7 +592,7 @@ TEST (websocket, confirmation_options_update) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send2); @@ -634,7 +634,7 @@ TEST (websocket, vote) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send); @@ -736,7 +736,7 @@ TEST (websocket, vote_options_representatives) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); node1->process_active (send); }; confirm_block (); @@ -1059,7 +1059,7 @@ TEST (websocket, new_unconfirmed_block) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); ASSERT_EQ (nano::block_status::progress, node1->process_local (send1).value ()); diff --git a/nano/lib/blockbuilders.cpp b/nano/lib/blockbuilders.cpp index edb5499d95..69b375eb11 100644 --- a/nano/lib/blockbuilders.cpp +++ b/nano/lib/blockbuilders.cpp @@ -652,7 +652,7 @@ nano::receive_block_builder & nano::receive_block_builder::source_hex (std::stri } template -std::unique_ptr nano::abstract_builder::build () +std::shared_ptr nano::abstract_builder::build () { if (!ec) { @@ -663,7 +663,7 @@ std::unique_ptr nano::abstract_builder::build () } template -std::unique_ptr nano::abstract_builder::build (std::error_code & ec) +std::shared_ptr nano::abstract_builder::build (std::error_code & ec) { if (!this->ec) { @@ -673,18 +673,6 @@ std::unique_ptr nano::abstract_builder::build (st return std::move (block); } -template -std::shared_ptr nano::abstract_builder::build_shared () -{ - return std::move (build ()); -} - -template -std::shared_ptr nano::abstract_builder::build_shared (std::error_code & ec) -{ - return std::move (build (ec)); -} - template nano::abstract_builder & nano::abstract_builder::work (uint64_t work) { diff --git a/nano/lib/blockbuilders.hpp b/nano/lib/blockbuilders.hpp index d77a441f01..077d584019 100644 --- a/nano/lib/blockbuilders.hpp +++ b/nano/lib/blockbuilders.hpp @@ -44,14 +44,10 @@ template class abstract_builder { public: - /** Returns the built block as a unique_ptr */ - std::unique_ptr build (); - /** Returns the built block as a unique_ptr. Any errors are placed in \p ec */ - std::unique_ptr build (std::error_code & ec); - /** Returns the built block as a shared_ptr */ - std::shared_ptr build_shared (); - /** Returns the built block as a shared_ptr. Any errors are placed in \p ec */ - std::shared_ptr build_shared (std::error_code & ec); + /** Returns the built block*/ + std::shared_ptr build (); + /** Returns the built block. Any errors are placed in \p ec */ + std::shared_ptr build (std::error_code & ec); /** Set work value */ abstract_builder & work (uint64_t work); /** Sign the block using the \p private_key and \p public_key */ diff --git a/nano/nano_node/entry.cpp b/nano/nano_node/entry.cpp index 89cff93745..64a899fab0 100644 --- a/nano/nano_node/entry.cpp +++ b/nano/nano_node/entry.cpp @@ -1029,7 +1029,7 @@ int main (int argc, char * const * argv) .build (); genesis_latest = send->hash (); - node->ledger.process (transaction, *send); + node->ledger.process (transaction, send); auto open = builder.state () .account (keys[i].pub) @@ -1041,7 +1041,7 @@ int main (int argc, char * const * argv) .work (*node->work.generate (nano::work_version::work_1, keys[i].pub, node->network_params.work.epoch_1)) .build (); - node->ledger.process (transaction, *open); + node->ledger.process (transaction, open); } // Generating blocks std::deque> blocks; diff --git a/nano/node/blockprocessor.cpp b/nano/node/blockprocessor.cpp index 471a3ccb6d..f9e2430e02 100644 --- a/nano/node/blockprocessor.cpp +++ b/nano/node/blockprocessor.cpp @@ -314,9 +314,9 @@ auto nano::block_processor::process_batch (nano::unique_lock & lock nano::block_status nano::block_processor::process_one (store::write_transaction const & transaction_a, context const & context, bool const forced_a) { - auto const & block = context.block; + auto block = context.block; auto const hash = block->hash (); - nano::block_status result = node.ledger.process (transaction_a, *block); + nano::block_status result = node.ledger.process (transaction_a, block); node.stats.inc (nano::stat::type::blockprocessor_result, to_stat_detail (result)); node.stats.inc (nano::stat::type::blockprocessor_source, to_stat_detail (context.source)); diff --git a/nano/node/node.cpp b/nano/node/node.cpp index b2a590699d..834cabbd9f 100644 --- a/nano/node/node.cpp +++ b/nano/node/node.cpp @@ -559,12 +559,12 @@ void nano::node::process_active (std::shared_ptr const & incoming) block_processor.add (incoming); } -[[nodiscard]] nano::block_status nano::node::process (store::write_transaction const & transaction, nano::block & block) +[[nodiscard]] nano::block_status nano::node::process (store::write_transaction const & transaction, std::shared_ptr block) { return ledger.process (transaction, block); } -nano::block_status nano::node::process (nano::block & block) +nano::block_status nano::node::process (std::shared_ptr block) { auto const transaction = store.tx_begin_write ({ tables::accounts, tables::blocks, tables::frontiers, tables::pending }); return process (transaction, block); diff --git a/nano/node/node.hpp b/nano/node/node.hpp index b26c452c2a..abd7b3651b 100644 --- a/nano/node/node.hpp +++ b/nano/node/node.hpp @@ -209,8 +209,8 @@ class node final : public std::enable_shared_from_this Creates a new write transaction and inserts `block' and returns result Transaction is comitted before function return */ - [[nodiscard]] nano::block_status process (nano::block & block); - [[nodiscard]] nano::block_status process (store::write_transaction const &, nano::block & block); + [[nodiscard]] nano::block_status process (std::shared_ptr block); + [[nodiscard]] nano::block_status process (store::write_transaction const &, std::shared_ptr block); nano::block_hash latest (nano::account const &); nano::uint128_t balance (nano::account const &); diff --git a/nano/qt_test/qt.cpp b/nano/qt_test/qt.cpp index e1750a9ae3..3a6d9b4dc1 100644 --- a/nano/qt_test/qt.cpp +++ b/nano/qt_test/qt.cpp @@ -422,7 +422,7 @@ TEST (wallet, create_send) std::stringstream istream (json); boost::property_tree::read_json (istream, tree1); bool error (false); - nano::state_block send (error, tree1); + auto send = std::make_shared (error, tree1); ASSERT_FALSE (error); ASSERT_EQ (nano::block_status::progress, system.nodes[0]->process (send)); ASSERT_EQ (nano::block_status::old, system.nodes[0]->process (send)); @@ -456,7 +456,7 @@ TEST (wallet, create_open_receive) std::stringstream istream1 (json1); boost::property_tree::read_json (istream1, tree1); bool error (false); - nano::state_block open (error, tree1); + auto open = std::make_shared (error, tree1); ASSERT_FALSE (error); ASSERT_EQ (nano::block_status::progress, system.nodes[0]->process (open)); ASSERT_EQ (nano::block_status::old, system.nodes[0]->process (open)); @@ -471,7 +471,7 @@ TEST (wallet, create_open_receive) std::stringstream istream2 (json2); boost::property_tree::read_json (istream2, tree2); bool error2 (false); - nano::state_block receive (error2, tree2); + auto receive = std::make_shared (error2, tree2); ASSERT_FALSE (error2); ASSERT_EQ (nano::block_status::progress, system.nodes[0]->process (receive)); ASSERT_EQ (nano::block_status::old, system.nodes[0]->process (receive)); @@ -499,7 +499,7 @@ TEST (wallet, create_change) std::stringstream istream (json); boost::property_tree::read_json (istream, tree1); bool error (false); - nano::state_block change (error, tree1); + auto change = std::make_shared (error, tree1); ASSERT_FALSE (error); ASSERT_EQ (nano::block_status::progress, system.nodes[0]->process (change)); ASSERT_EQ (nano::block_status::old, system.nodes[0]->process (change)); @@ -531,11 +531,11 @@ TEST (history, short_text) store->initialize (transaction, ledger.cache, ledger.constants); nano::keypair key; auto latest (ledger.latest (transaction, nano::dev::genesis_key.pub)); - nano::send_block send (latest, nano::dev::genesis_key.pub, 0, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (latest)); + auto send = std::make_shared (latest, nano::dev::genesis_key.pub, 0, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (latest)); ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); - nano::receive_block receive (send.hash (), send.hash (), nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (send.hash ())); + auto receive = std::make_shared (send->hash (), send->hash (), nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (send->hash ())); ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive)); - nano::change_block change (receive.hash (), key.pub, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (receive.hash ())); + auto change = std::make_shared (receive->hash (), key.pub, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (receive->hash ())); ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, change)); } nano_qt::history history (ledger, nano::dev::genesis_key.pub, *wallet); @@ -571,16 +571,16 @@ TEST (history, pruned_source) auto transaction (store->tx_begin_write ()); store->initialize (transaction, ledger.cache, nano::dev::constants); auto latest (ledger.latest (transaction, nano::dev::genesis_key.pub)); - nano::send_block send1 (latest, nano::dev::genesis_key.pub, nano::dev::constants.genesis_amount - 100, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (latest)); + auto send1 = std::make_shared (latest, nano::dev::genesis_key.pub, nano::dev::constants.genesis_amount - 100, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (latest)); ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send1)); - nano::send_block send2 (send1.hash (), key.pub, nano::dev::constants.genesis_amount - 200, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (send1.hash ())); + auto send2 = std::make_shared (send1->hash (), key.pub, nano::dev::constants.genesis_amount - 200, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (send1->hash ())); ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send2)); - nano::receive_block receive (send2.hash (), send1.hash (), nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (send2.hash ())); + auto receive = std::make_shared (send2->hash (), send1->hash (), nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (send2->hash ())); ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive)); - nano::open_block open (send2.hash (), key.pub, key.pub, key.prv, key.pub, *system.work.generate (key.pub)); + auto open = std::make_shared (send2->hash (), key.pub, key.pub, key.prv, key.pub, *system.work.generate (key.pub)); ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); - ASSERT_EQ (1, ledger.pruning_action (transaction, send1.hash (), 2)); - next_pruning = send2.hash (); + ASSERT_EQ (1, ledger.pruning_action (transaction, send1->hash (), 2)); + next_pruning = send2->hash (); } nano_qt::history history1 (ledger, nano::dev::genesis_key.pub, *wallet); history1.refresh (); @@ -601,10 +601,10 @@ TEST (history, pruned_source) { auto transaction (store->tx_begin_write ()); auto latest (ledger.latest (transaction, nano::dev::genesis_key.pub)); - nano::state_block send (nano::dev::genesis_key.pub, latest, nano::dev::genesis_key.pub, nano::dev::constants.genesis_amount - 200, key.pub, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (latest)); + auto send = std::make_shared (nano::dev::genesis_key.pub, latest, nano::dev::genesis_key.pub, nano::dev::constants.genesis_amount - 200, key.pub, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (latest)); ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); auto latest_key (ledger.latest (transaction, key.pub)); - nano::state_block receive (key.pub, latest_key, key.pub, 200, send.hash (), key.prv, key.pub, *system.work.generate (latest_key)); + auto receive = std::make_shared (key.pub, latest_key, key.pub, 200, send->hash (), key.prv, key.pub, *system.work.generate (latest_key)); ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive)); ASSERT_EQ (1, ledger.pruning_action (transaction, latest, 2)); ASSERT_EQ (1, ledger.pruning_action (transaction, latest_key, 2)); @@ -716,8 +716,8 @@ TEST (wallet, republish) { auto transaction (system.nodes[0]->store.tx_begin_write ()); auto latest (system.nodes[0]->ledger.latest (transaction, nano::dev::genesis_key.pub)); - nano::send_block block (latest, key.pub, 0, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (latest)); - hash = block.hash (); + auto block = std::make_shared (latest, key.pub, 0, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system.work.generate (latest)); + hash = block->hash (); ASSERT_EQ (nano::block_status::progress, system.nodes[0]->ledger.process (transaction, block)); } auto account (nano::dev::genesis_key.pub); @@ -916,7 +916,7 @@ TEST (wallet, DISABLED_synchronizing) { auto transaction (system1.nodes[0]->store.tx_begin_write ()); auto latest (system1.nodes[0]->ledger.latest (transaction, nano::dev::genesis->account ())); - nano::send_block send (latest, key1, 0, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system1.work.generate (latest)); + auto send = std::make_shared (latest, key1, 0, nano::dev::genesis_key.prv, nano::dev::genesis_key.pub, *system1.work.generate (latest)); system1.nodes[0]->ledger.process (transaction, send); } ASSERT_EQ (0, wallet->active_status.active.count (nano_qt::status_types::synchronizing)); @@ -965,10 +965,10 @@ TEST (wallet, epoch_2_validation) std::stringstream istream (json); boost::property_tree::read_json (istream, tree1); bool error (false); - nano::state_block block (error, tree1); + auto block = std::make_shared (error, tree1); EXPECT_FALSE (error); EXPECT_EQ (nano::block_status::progress, node->process (block)); - return block.hash (); + return block->hash (); }; auto do_send = [&] (nano::public_key const & destination) -> nano::block_hash { diff --git a/nano/rpc_test/receivable.cpp b/nano/rpc_test/receivable.cpp index 972dcbfa04..81563180d0 100644 --- a/nano/rpc_test/receivable.cpp +++ b/nano/rpc_test/receivable.cpp @@ -370,7 +370,7 @@ TEST (rpc, search_receivable) .build (); { auto transaction (node->store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *block)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, block)); } auto const rpc_ctx = add_rpc (system, node); boost::property_tree::ptree request; diff --git a/nano/rpc_test/rpc.cpp b/nano/rpc_test/rpc.cpp index 3a5bf6dfe8..4f1c158f98 100644 --- a/nano/rpc_test/rpc.cpp +++ b/nano/rpc_test/rpc.cpp @@ -72,7 +72,7 @@ TEST (rpc, account_balance) .work (*system.work.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node->process (*send1)); + ASSERT_EQ (nano::block_status::progress, node->process (send1)); ASSERT_TIMELY (5s, !node->active.active (*send1)); auto const rpc_ctx = add_rpc (system, node); @@ -152,7 +152,7 @@ TEST (rpc, account_weight) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*block)); + ASSERT_EQ (nano::block_status::progress, node1->process (block)); auto const rpc_ctx = add_rpc (system, node1); boost::property_tree::ptree request; request.put ("action", "account_weight"); @@ -957,9 +957,9 @@ TEST (rpc, history) .build (); { auto transaction (node0->store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, *usend)); - ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, *ureceive)); - ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, *uchange)); + ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, usend)); + ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, ureceive)); + ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, uchange)); } auto const rpc_ctx = add_rpc (system, node0); boost::property_tree::ptree request; @@ -1041,9 +1041,9 @@ TEST (rpc, account_history) .build (); { auto transaction (node0->store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, *usend)); - ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, *ureceive)); - ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, *uchange)); + ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, usend)); + ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, ureceive)); + ASSERT_EQ (nano::block_status::progress, node0->ledger.process (transaction, uchange)); } auto const rpc_ctx = add_rpc (system, node0); { @@ -1183,7 +1183,7 @@ TEST (rpc, history_pruning) .representative (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); blocks.push_back (change); // legacy send to itself @@ -1194,7 +1194,7 @@ TEST (rpc, history_pruning) .balance (nano::dev::constants.genesis_amount - node0->config.receive_minimum.number ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work.generate (change->hash ())) - .build_shared (); + .build (); blocks.push_back (send); // legacy receive the legacy self send @@ -1204,7 +1204,7 @@ TEST (rpc, history_pruning) .source (send->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work.generate (send->hash ())) - .build_shared (); + .build (); blocks.push_back (receive); // non legacy self send @@ -1217,7 +1217,7 @@ TEST (rpc, history_pruning) .link (nano::dev::genesis->account ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (receive->hash ())) - .build_shared (); + .build (); blocks.push_back (usend); // non legacy receive of the non legacy self send @@ -1230,7 +1230,7 @@ TEST (rpc, history_pruning) .link (usend->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (usend->hash ())) - .build_shared (); + .build (); blocks.push_back (ureceive); // change genesis to a random rep @@ -1243,7 +1243,7 @@ TEST (rpc, history_pruning) .link (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node0->work_generate_blocking (ureceive->hash ())) - .build_shared (); + .build (); blocks.push_back (uchange); nano::test::process_live (*node0, blocks); @@ -1438,7 +1438,7 @@ TEST (rpc, process_block_async) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); std::string json1; state_send->serialize_json (json1); request.put ("block", json1); @@ -1556,9 +1556,9 @@ TEST (rpc, process_subtype_open) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); - ASSERT_EQ (nano::block_status::progress, node2.process (*send)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); + ASSERT_EQ (nano::block_status::progress, node2.process (send)); auto const rpc_ctx = add_rpc (system, node1); node1->scheduler.manual.push (send); auto open = builder @@ -1605,9 +1605,9 @@ TEST (rpc, process_subtype_receive) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); - ASSERT_EQ (nano::block_status::progress, node2.process (*send)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); + ASSERT_EQ (nano::block_status::progress, node2.process (send)); auto const rpc_ctx = add_rpc (system, node1); node1->scheduler.manual.push (send); auto receive = builder @@ -2227,7 +2227,7 @@ TEST (rpc, block_count_pruning) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) - .build_shared (); + .build (); node1->process_active (send1); auto receive1 = builder .receive () @@ -2235,7 +2235,7 @@ TEST (rpc, block_count_pruning) .source (send1->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (send1->hash ())) - .build_shared (); + .build (); node1->process_active (receive1); system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); ASSERT_TIMELY (5s, node1->block_confirmed (receive1->hash ())); @@ -2497,7 +2497,7 @@ TEST (rpc, bootstrap) .build (); { auto transaction (node1->store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node1->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node1->ledger.process (transaction, send)); } auto const rpc_ctx = add_rpc (system0, node); boost::property_tree::ptree request; @@ -2782,7 +2782,7 @@ TEST (rpc, bootstrap_any) .build (); { auto transaction (system1.nodes[0]->store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, system1.nodes[0]->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, system1.nodes[0]->ledger.process (transaction, send)); } auto const rpc_ctx = add_rpc (system0, node); boost::property_tree::ptree request; @@ -2808,7 +2808,7 @@ TEST (rpc, republish) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); auto open = builder .open () .source (send->hash ()) @@ -2817,7 +2817,7 @@ TEST (rpc, republish) .sign (key.prv, key.pub) .work (*node1->work_generate_blocking (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); auto const rpc_ctx = add_rpc (system, node1); boost::property_tree::ptree request; request.put ("action", "republish"); @@ -2995,10 +2995,10 @@ TEST (rpc, accounts_balances_unopened_account_with_receivables) .link (unopened_account.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); } ASSERT_TIMELY (5s, node->block (send->hash ())); ASSERT_TIMELY (5s, !node->active.active (*send)); @@ -3531,7 +3531,7 @@ TEST (rpc, search_receivable_all) .build (); { auto transaction (node->store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *block)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, block)); } auto const rpc_ctx = add_rpc (system, node); boost::property_tree::ptree request; @@ -3563,7 +3563,7 @@ TEST (rpc, wallet_republish) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); auto open = builder .open () .source (send->hash ()) @@ -3572,7 +3572,7 @@ TEST (rpc, wallet_republish) .sign (key.prv, key.pub) .work (*node1->work_generate_blocking (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); auto const rpc_ctx = add_rpc (system, node1); boost::property_tree::ptree request; request.put ("action", "wallet_republish"); @@ -3607,7 +3607,7 @@ TEST (rpc, delegators) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); auto open = builder .open () .source (send->hash ()) @@ -3616,7 +3616,7 @@ TEST (rpc, delegators) .sign (key.prv, key.pub) .work (*node1->work_generate_blocking (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); auto const rpc_ctx = add_rpc (system, node1); boost::property_tree::ptree request; request.put ("action", "delegators"); @@ -3648,7 +3648,7 @@ TEST (rpc, delegators_parameters) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); auto open = builder .open () .source (send->hash ()) @@ -3657,7 +3657,7 @@ TEST (rpc, delegators_parameters) .sign (key.prv, key.pub) .work (*node1->work_generate_blocking (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); auto const rpc_ctx = add_rpc (system, node1); // Test with "count" = 2 @@ -3758,7 +3758,7 @@ TEST (rpc, delegators_count) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); auto open = builder .open () .source (send->hash ()) @@ -3767,7 +3767,7 @@ TEST (rpc, delegators_count) .sign (key.prv, key.pub) .work (*node1->work_generate_blocking (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); auto const rpc_ctx = add_rpc (system, node1); boost::property_tree::ptree request; request.put ("action", "delegators_count"); @@ -3810,7 +3810,7 @@ TEST (rpc, account_info) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); auto time = nano::seconds_since_epoch (); { auto transaction = node1->store.tx_begin_write (); @@ -3869,7 +3869,7 @@ TEST (rpc, account_info) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send1)); + ASSERT_EQ (nano::block_status::progress, node1->process (send1)); auto send2 = builder .send () .previous (send1->hash ()) @@ -3878,7 +3878,7 @@ TEST (rpc, account_info) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (send1->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send2)); + ASSERT_EQ (nano::block_status::progress, node1->process (send2)); auto state_change = builder .state () @@ -3890,7 +3890,7 @@ TEST (rpc, account_info) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (send2->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*state_change)); + ASSERT_EQ (nano::block_status::progress, node1->process (state_change)); auto open = builder .open () @@ -3900,7 +3900,7 @@ TEST (rpc, account_info) .sign (key1.prv, key1.pub) .work (*node1->work_generate_blocking (key1.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); ASSERT_TIMELY (5s, !node1->active.active (*state_change)); ASSERT_TIMELY (5s, !node1->active.active (*open)); } @@ -4018,7 +4018,7 @@ TEST (rpc, json_block_output) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); auto const rpc_ctx = add_rpc (system, node1); boost::property_tree::ptree request; request.put ("action", "block_info"); @@ -4240,7 +4240,7 @@ TEST (rpc, block_info_successor) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); auto const rpc_ctx = add_rpc (system, node1); boost::property_tree::ptree request; request.put ("action", "block_info"); @@ -4276,7 +4276,7 @@ TEST (rpc, block_info_pruning) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) - .build_shared (); + .build (); node1->process_active (send1); auto receive1 = builder .receive () @@ -4284,7 +4284,7 @@ TEST (rpc, block_info_pruning) .source (send1->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (send1->hash ())) - .build_shared (); + .build (); node1->process_active (receive1); system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); ASSERT_TIMELY (5s, node1->block_confirmed (receive1->hash ())); @@ -4342,7 +4342,7 @@ TEST (rpc, pruned_exists) .balance (nano::dev::constants.genesis_amount - nano::Gxrb_ratio) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) - .build_shared (); + .build (); node1->process_active (send1); auto receive1 = builder .receive () @@ -4350,7 +4350,7 @@ TEST (rpc, pruned_exists) .source (send1->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (send1->hash ())) - .build_shared (); + .build (); node1->process_active (receive1); system.wallet (0)->insert_adhoc (nano::dev::genesis_key.prv); ASSERT_TIMELY (5s, node1->block_confirmed (receive1->hash ())); @@ -4430,7 +4430,7 @@ TEST (rpc, populate_backlog) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node->process (*send)); + ASSERT_EQ (nano::block_status::progress, node->process (send)); auto const rpc_ctx = add_rpc (system, node); boost::property_tree::ptree request; @@ -4461,7 +4461,7 @@ TEST (rpc, ledger) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node->process (*send)); + ASSERT_EQ (nano::block_status::progress, node->process (send)); auto open = builder .open () .source (send->hash ()) @@ -4470,7 +4470,7 @@ TEST (rpc, ledger) .sign (key.prv, key.pub) .work (*node->work_generate_blocking (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node->process (*open)); + ASSERT_EQ (nano::block_status::progress, node->process (open)); auto time = nano::seconds_since_epoch (); auto const rpc_ctx = add_rpc (system, node); boost::property_tree::ptree request; @@ -4544,7 +4544,7 @@ TEST (rpc, ledger) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node->work_generate_blocking (send->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node->process (*send2)); + ASSERT_EQ (nano::block_status::progress, node->process (send2)); // When asking for pending, pending amount is taken into account for threshold so the account must show up request.put ("count", 2); request.put ("threshold", (send_amount + send2_amount).convert_to ()); @@ -4631,7 +4631,7 @@ TEST (rpc, block_create) boost::property_tree::read_json (block_stream, block_l); auto send_block (nano::deserialize_block_json (block_l)); ASSERT_EQ (send->hash (), send_block->hash ()); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); boost::property_tree::ptree request1; request1.put ("action", "block_create"); request1.put ("type", "open"); @@ -4649,7 +4649,7 @@ TEST (rpc, block_create) boost::property_tree::read_json (block_stream1, block_l); auto open_block (nano::deserialize_block_json (block_l)); ASSERT_EQ (open->hash (), open_block->hash ()); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); request1.put ("representative", key.pub.to_account ()); auto response2 (wait_response (system, rpc_ctx, request1)); std::string open2_hash (response2.get ("hash")); @@ -4672,7 +4672,7 @@ TEST (rpc, block_create) boost::property_tree::read_json (block_stream4, block_l); auto change_block (nano::deserialize_block_json (block_l)); ASSERT_EQ (change->hash (), change_block->hash ()); - ASSERT_EQ (nano::block_status::progress, node1->process (*change)); + ASSERT_EQ (nano::block_status::progress, node1->process (change)); auto send2 = builder .send () .previous (send->hash ()) @@ -4681,7 +4681,7 @@ TEST (rpc, block_create) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (send->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send2)); + ASSERT_EQ (nano::block_status::progress, node1->process (send2)); boost::property_tree::ptree request2; request2.put ("action", "block_create"); request2.put ("type", "receive"); @@ -4729,7 +4729,7 @@ TEST (rpc, block_create_state) ASSERT_NE (nullptr, state_block); ASSERT_EQ (nano::block_type::state, state_block->type ()); ASSERT_EQ (state_hash, state_block->hash ().to_string ()); - auto process_result (node->process (*state_block)); + auto process_result (node->process (state_block)); ASSERT_EQ (nano::block_status::progress, process_result); } @@ -4765,7 +4765,7 @@ TEST (rpc, block_create_state_open) auto difficulty (nano::dev::network_params.work.difficulty (*state_block)); ASSERT_GT (difficulty, nano::dev::network_params.work.threshold (state_block->work_version (), nano::block_details (nano::epoch::epoch_0, false, true, false))); ASSERT_TRUE (node->latest (key.pub).is_zero ()); - auto process_result (node->process (*state_block)); + auto process_result (node->process (state_block)); ASSERT_EQ (nano::block_status::progress, process_result); ASSERT_EQ (state_block->sideband ().details.epoch, nano::epoch::epoch_0); ASSERT_TRUE (state_block->sideband ().details.is_receive); @@ -4777,7 +4777,7 @@ TEST (rpc, block_create_state_request_work) { // Test work generation for state blocks both with and without previous (in the latter // case, the account will be used for work generation) - std::unique_ptr epoch2; + std::shared_ptr epoch2; { nano::test::system system (1); system.upgrade_genesis_epoch (*system.nodes.front (), nano::epoch::epoch_1); @@ -4844,7 +4844,7 @@ TEST (rpc, block_create_open_epoch_v2) auto difficulty (nano::dev::network_params.work.difficulty (*state_block)); ASSERT_GT (difficulty, nano::dev::network_params.work.threshold (state_block->work_version (), nano::block_details (nano::epoch::epoch_2, false, true, false))); ASSERT_TRUE (node->latest (key.pub).is_zero ()); - auto process_result (node->process (*state_block)); + auto process_result (node->process (state_block)); ASSERT_EQ (nano::block_status::progress, process_result); ASSERT_EQ (state_block->sideband ().details.epoch, nano::epoch::epoch_2); ASSERT_TRUE (state_block->sideband ().details.is_receive); @@ -4871,7 +4871,7 @@ TEST (rpc, block_create_receive_epoch_v2) .sign (key.prv, key.pub) .work (*node->work_generate_blocking (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node->process (*open)); + ASSERT_EQ (nano::block_status::progress, node->process (open)); ASSERT_NE (nullptr, system.upgrade_genesis_epoch (*node, nano::epoch::epoch_2)); auto send_block_2 (system.wallet (0)->send_action (nano::dev::genesis_key.pub, key.pub, nano::Gxrb_ratio)); auto const rpc_ctx = add_rpc (system, node); @@ -4896,7 +4896,7 @@ TEST (rpc, block_create_receive_epoch_v2) ASSERT_EQ (state_hash, state_block->hash ().to_string ()); auto difficulty (nano::dev::network_params.work.difficulty (*state_block)); ASSERT_GT (difficulty, nano::dev::network_params.work.threshold (state_block->work_version (), nano::block_details (nano::epoch::epoch_2, false, true, false))); - auto process_result (node->process (*state_block)); + auto process_result (node->process (state_block)); ASSERT_EQ (nano::block_status::progress, process_result); ASSERT_EQ (state_block->sideband ().details.epoch, nano::epoch::epoch_2); ASSERT_TRUE (state_block->sideband ().details.is_receive); @@ -4924,7 +4924,7 @@ TEST (rpc, block_create_send_epoch_v2) .sign (key.prv, key.pub) .work (*node->work_generate_blocking (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node->process (*open)); + ASSERT_EQ (nano::block_status::progress, node->process (open)); auto const rpc_ctx = add_rpc (system, node); boost::property_tree::ptree request; request.put ("action", "block_create"); @@ -4947,7 +4947,7 @@ TEST (rpc, block_create_send_epoch_v2) ASSERT_EQ (state_hash, state_block->hash ().to_string ()); auto difficulty (nano::dev::network_params.work.difficulty (*state_block)); ASSERT_GT (difficulty, nano::dev::network_params.work.threshold (state_block->work_version (), nano::block_details (nano::epoch::epoch_2, true, false, false))); - auto process_result (node->process (*state_block)); + auto process_result (node->process (state_block)); ASSERT_EQ (nano::block_status::progress, process_result); ASSERT_EQ (state_block->sideband ().details.epoch, nano::epoch::epoch_2); ASSERT_TRUE (state_block->sideband ().details.is_send); @@ -5048,7 +5048,7 @@ TEST (rpc, wallet_ledger) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node1->work_generate_blocking (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send)); + ASSERT_EQ (nano::block_status::progress, node1->process (send)); auto open = builder .open () .source (send->hash ()) @@ -5057,7 +5057,7 @@ TEST (rpc, wallet_ledger) .sign (key.prv, key.pub) .work (*node1->work_generate_blocking (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); auto time = nano::seconds_since_epoch (); auto const rpc_ctx = add_rpc (system, node1); boost::property_tree::ptree request; @@ -5221,7 +5221,7 @@ TEST (rpc, confirmation_height_currently_processing) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous_genesis_chain_hash)) .build (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); previous_genesis_chain_hash = send->hash (); } @@ -5340,10 +5340,10 @@ TEST (rpc, block_confirm) .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*node->work_generate_blocking (nano::dev::genesis->hash ())) - .build_shared (); + .build (); { auto transaction (node->store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); } auto const rpc_ctx = add_rpc (system, node); boost::property_tree::ptree request; @@ -5445,7 +5445,7 @@ TEST (rpc, unchecked) .link (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); auto open2 = builder .state () .account (key.pub) @@ -5455,7 +5455,7 @@ TEST (rpc, unchecked) .link (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); node->process_active (open); node->process_active (open2); // Waits for the last block of the queue to get saved in the database @@ -5497,7 +5497,7 @@ TEST (rpc, unchecked_get) .link (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); node->process_active (open); // Waits for the open block to get saved in the database ASSERT_TIMELY_EQ (10s, 1, node->unchecked.count ()); @@ -5536,7 +5536,7 @@ TEST (rpc, unchecked_clear) .link (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); node->process_active (open); boost::property_tree::ptree request{}; // Waits for the open block to get saved in the database @@ -5799,7 +5799,7 @@ TEST (rpc, memory_stats) .link (0) .sign (key.prv, key.pub) .work (0) - .build_shared (); + .build (); std::vector hashes; hashes.push_back (block->hash ()); auto vote = nano::test::make_vote (key, { hashes }, 0, 0); @@ -5850,7 +5850,7 @@ TEST (rpc, block_confirmed) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); auto open1 = builder .open () @@ -5860,7 +5860,7 @@ TEST (rpc, block_confirmed) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open1)); } // This should not be confirmed @@ -5877,7 +5877,7 @@ TEST (rpc, block_confirmed) .balance (10) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); node->process_active (send); ASSERT_TRUE (nano::test::start_elections (system, *node, { send }, true)); @@ -6143,8 +6143,8 @@ TEST (rpc, epoch_upgrade) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); // to opened account - ASSERT_EQ (nano::block_status::progress, node->process (*send1)); + .build (); // to opened account + ASSERT_EQ (nano::block_status::progress, node->process (send1)); auto send2 = builder .state () .account (nano::dev::genesis_key.pub) @@ -6154,8 +6154,8 @@ TEST (rpc, epoch_upgrade) .link (key2.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); // to unopened account (pending) - ASSERT_EQ (nano::block_status::progress, node->process (*send2)); + .build (); // to unopened account (pending) + ASSERT_EQ (nano::block_status::progress, node->process (send2)); auto send3 = builder .state () .account (nano::dev::genesis_key.pub) @@ -6165,8 +6165,8 @@ TEST (rpc, epoch_upgrade) .link (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send2->hash ())) - .build_shared (); // to burn (0) - ASSERT_EQ (nano::block_status::progress, node->process (*send3)); + .build (); // to burn (0) + ASSERT_EQ (nano::block_status::progress, node->process (send3)); nano::account max_account (std::numeric_limits::max ()); auto send4 = builder .state () @@ -6177,8 +6177,8 @@ TEST (rpc, epoch_upgrade) .link (max_account) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send3->hash ())) - .build_shared (); // to max account - ASSERT_EQ (nano::block_status::progress, node->process (*send4)); + .build (); // to max account + ASSERT_EQ (nano::block_status::progress, node->process (send4)); auto open = builder .state () .account (key1.pub) @@ -6188,8 +6188,8 @@ TEST (rpc, epoch_upgrade) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node->process (*open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node->process (open)); // Check accounts epochs { auto transaction (node->store.tx_begin_read ()); @@ -6234,8 +6234,8 @@ TEST (rpc, epoch_upgrade) .link (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (genesis_latest)) - .build_shared (); // to burn (0) - ASSERT_EQ (nano::block_status::progress, node->process (*send5)); + .build (); // to burn (0) + ASSERT_EQ (nano::block_status::progress, node->process (send5)); auto send6 = builder .state () .account (nano::dev::genesis_key.pub) @@ -6245,8 +6245,8 @@ TEST (rpc, epoch_upgrade) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send5->hash ())) - .build_shared (); // to key1 (again) - ASSERT_EQ (nano::block_status::progress, node->process (*send6)); + .build (); // to key1 (again) + ASSERT_EQ (nano::block_status::progress, node->process (send6)); auto key1_latest (node->latest (key1.pub)); auto send7 = builder .state () @@ -6257,8 +6257,8 @@ TEST (rpc, epoch_upgrade) .link (key3.pub) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1_latest)) - .build_shared (); // to key3 - ASSERT_EQ (nano::block_status::progress, node->process (*send7)); + .build (); // to key3 + ASSERT_EQ (nano::block_status::progress, node->process (send7)); { // Check pending entry auto transaction (node->store.tx_begin_read ()); @@ -6306,8 +6306,8 @@ TEST (rpc, epoch_upgrade_multithreaded) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); // to opened account - ASSERT_EQ (nano::block_status::progress, node->process (*send1)); + .build (); // to opened account + ASSERT_EQ (nano::block_status::progress, node->process (send1)); auto send2 = builder .state () .account (nano::dev::genesis_key.pub) @@ -6317,8 +6317,8 @@ TEST (rpc, epoch_upgrade_multithreaded) .link (key2.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); // to unopened account (pending) - ASSERT_EQ (nano::block_status::progress, node->process (*send2)); + .build (); // to unopened account (pending) + ASSERT_EQ (nano::block_status::progress, node->process (send2)); auto send3 = builder .state () .account (nano::dev::genesis_key.pub) @@ -6328,8 +6328,8 @@ TEST (rpc, epoch_upgrade_multithreaded) .link (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send2->hash ())) - .build_shared (); // to burn (0) - ASSERT_EQ (nano::block_status::progress, node->process (*send3)); + .build (); // to burn (0) + ASSERT_EQ (nano::block_status::progress, node->process (send3)); nano::account max_account (std::numeric_limits::max ()); auto send4 = builder .state () @@ -6340,8 +6340,8 @@ TEST (rpc, epoch_upgrade_multithreaded) .link (max_account) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send3->hash ())) - .build_shared (); // to max account - ASSERT_EQ (nano::block_status::progress, node->process (*send4)); + .build (); // to max account + ASSERT_EQ (nano::block_status::progress, node->process (send4)); auto open = builder .state () .account (key1.pub) @@ -6351,8 +6351,8 @@ TEST (rpc, epoch_upgrade_multithreaded) .link (send1->hash ()) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node->process (*open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node->process (open)); // Check accounts epochs { auto transaction (node->store.tx_begin_read ()); @@ -6398,8 +6398,8 @@ TEST (rpc, epoch_upgrade_multithreaded) .link (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (genesis_latest)) - .build_shared (); // to burn (0) - ASSERT_EQ (nano::block_status::progress, node->process (*send5)); + .build (); // to burn (0) + ASSERT_EQ (nano::block_status::progress, node->process (send5)); auto send6 = builder .state () .account (nano::dev::genesis_key.pub) @@ -6409,8 +6409,8 @@ TEST (rpc, epoch_upgrade_multithreaded) .link (key1.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send5->hash ())) - .build_shared (); // to key1 (again) - ASSERT_EQ (nano::block_status::progress, node->process (*send6)); + .build (); // to key1 (again) + ASSERT_EQ (nano::block_status::progress, node->process (send6)); auto key1_latest (node->latest (key1.pub)); auto send7 = builder .state () @@ -6421,8 +6421,8 @@ TEST (rpc, epoch_upgrade_multithreaded) .link (key3.pub) .sign (key1.prv, key1.pub) .work (*system.work.generate (key1_latest)) - .build_shared (); // to key3 - ASSERT_EQ (nano::block_status::progress, node->process (*send7)); + .build (); // to key3 + ASSERT_EQ (nano::block_status::progress, node->process (send7)); { // Check pending entry auto transaction (node->store.tx_begin_read ()); @@ -6470,8 +6470,8 @@ TEST (rpc, account_lazy_start) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*send1)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (send1)); auto open = builder .open () .source (send1->hash ()) @@ -6479,8 +6479,8 @@ TEST (rpc, account_lazy_start) .account (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node1->process (*open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node1->process (open)); // Start lazy bootstrap with account nano::node_config node_config = system.default_config (); @@ -6869,7 +6869,7 @@ TEST (rpc, confirmation_active) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); auto send2 = builder .send () .previous (send1->hash ()) @@ -6877,7 +6877,7 @@ TEST (rpc, confirmation_active) .balance (nano::dev::constants.genesis_amount - 200) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (send1->hash ())) - .build_shared (); + .build (); node1->process_active (send1); node1->process_active (send2); ASSERT_TRUE (nano::test::start_elections (system, *node1, { send1, send2 })); @@ -6913,7 +6913,7 @@ TEST (rpc, confirmation_info) .balance (nano::dev::constants.genesis_amount - 100) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); node1->process_active (send); ASSERT_TIMELY (5s, !node1->active.empty ()); diff --git a/nano/secure/ledger.cpp b/nano/secure/ledger.cpp index 62503f5c1d..c23ffc73b4 100644 --- a/nano/secure/ledger.cpp +++ b/nano/secure/ledger.cpp @@ -915,11 +915,11 @@ std::optional nano::ledger::pending_info (store::transaction return std::nullopt; } -nano::block_status nano::ledger::process (store::write_transaction const & transaction_a, nano::block & block_a) +nano::block_status nano::ledger::process (store::write_transaction const & transaction_a, std::shared_ptr block_a) { - debug_assert (!constants.work.validate_entry (block_a) || constants.genesis == nano::dev::genesis); + debug_assert (!constants.work.validate_entry (*block_a) || constants.genesis == nano::dev::genesis); ledger_processor processor (*this, transaction_a); - block_a.visit (processor); + block_a->visit (processor); if (processor.result == nano::block_status::progress) { ++cache.block_count; diff --git a/nano/secure/ledger.hpp b/nano/secure/ledger.hpp index 9f3c69a571..935f57e2cb 100644 --- a/nano/secure/ledger.hpp +++ b/nano/secure/ledger.hpp @@ -72,7 +72,7 @@ class ledger final nano::block_hash block_source (store::transaction const &, nano::block const &); std::pair hash_root_random (store::transaction const &) const; std::optional pending_info (store::transaction const & transaction, nano::pending_key const & key) const; - nano::block_status process (store::write_transaction const &, nano::block &); + nano::block_status process (store::write_transaction const & transaction, std::shared_ptr block); bool rollback (store::write_transaction const &, nano::block_hash const &, std::vector> &); bool rollback (store::write_transaction const &, nano::block_hash const &); void update_account (store::write_transaction const &, nano::account const &, nano::account_info const &, nano::account_info const &); diff --git a/nano/slow_test/node.cpp b/nano/slow_test/node.cpp index ed8ef26976..1dd982e004 100644 --- a/nano/slow_test/node.cpp +++ b/nano/slow_test/node.cpp @@ -136,7 +136,7 @@ TEST (ledger, deep_account_compute) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); auto open = builder .open () .source (send->hash ()) @@ -145,7 +145,7 @@ TEST (ledger, deep_account_compute) .sign (key.prv, key.pub) .work (*pool.generate (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); auto sprevious (send->hash ()); auto rprevious (open->hash ()); for (auto i (0), n (100000); i != n; ++i) @@ -159,7 +159,7 @@ TEST (ledger, deep_account_compute) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (sprevious)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); sprevious = send->hash (); auto receive = builder .receive () @@ -168,7 +168,7 @@ TEST (ledger, deep_account_compute) .sign (key.prv, key.pub) .work (*pool.generate (rprevious)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive)); rprevious = receive->hash (); if (i % 100 == 0) { @@ -277,7 +277,7 @@ TEST (node, fork_storm) previous = send->hash (); for (auto node_i : system.nodes) { - auto send_result (node_i->process (*send)); + auto send_result (node_i->process (send)); ASSERT_EQ (nano::block_status::progress, send_result); nano::keypair rep; auto open = builder @@ -287,9 +287,9 @@ TEST (node, fork_storm) .account (key.pub) .sign (key.prv, key.pub) .work (0) - .build_shared (); + .build (); node_i->work_generate_blocking (*open); - auto open_result (node_i->process (*open)); + auto open_result (node_i->process (open)); ASSERT_EQ (nano::block_status::progress, open_result); auto transaction (node_i->store.tx_begin_read ()); node_i->network.flood_block (open); @@ -507,7 +507,7 @@ TEST (store, unchecked_load) .balance (0) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (0) - .build_shared (); + .build (); constexpr auto num_unchecked = 1'000'000; for (auto i (0); i < num_unchecked; ++i) { @@ -618,7 +618,7 @@ TEST (node, mass_vote_by_hash) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous)) - .build_shared (); + .build (); previous = block->hash (); blocks.push_back (block); } @@ -660,7 +660,7 @@ TEST (confirmation_height, many_accounts_single_confirmation) .sign (last_keypair.prv, last_keypair.pub) .work (*system.work.generate (last_open_hash)) .build (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); auto open = builder .open () .source (send->hash ()) @@ -669,7 +669,7 @@ TEST (confirmation_height, many_accounts_single_confirmation) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) .build (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open)); last_open_hash = open->hash (); last_keypair = key; } @@ -744,7 +744,7 @@ TEST (confirmation_height, many_accounts_many_confirmations) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_genesis)) .build (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); auto open = builder .open () .source (send->hash ()) @@ -752,8 +752,8 @@ TEST (confirmation_height, many_accounts_many_confirmations) .account (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open)); open_blocks.push_back (std::move (open)); latest_genesis = send->hash (); } @@ -826,8 +826,8 @@ TEST (confirmation_height, long_chains) .build (); { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open)); } // Bulk send from genesis account to destination account @@ -845,7 +845,7 @@ TEST (confirmation_height, long_chains) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous_genesis_chain_hash)) .build (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); auto receive = builder .receive () .previous (previous_destination_chain_hash) @@ -853,7 +853,7 @@ TEST (confirmation_height, long_chains) .sign (key1.prv, key1.pub) .work (*system.work.generate (previous_destination_chain_hash)) .build (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive)); previous_genesis_chain_hash = send->hash (); previous_destination_chain_hash = receive->hash (); @@ -878,7 +878,7 @@ TEST (confirmation_height, long_chains) .link (send1->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (previous_genesis_chain_hash)) - .build_shared (); + .build (); // Unpocketed. Send to a non-existing account to prevent auto receives from the wallet adjusting expected confirmation height nano::keypair key2; @@ -895,9 +895,9 @@ TEST (confirmation_height, long_chains) { auto transaction = node->store.tx_begin_write (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *receive1)); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send2)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, receive1)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send2)); } // Call block confirm on the existing receive block on the genesis account which will confirm everything underneath on both accounts @@ -962,7 +962,7 @@ TEST (confirmation_height, dynamic_algorithm) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_genesis->hash ())) - .build_shared (); + .build (); latest_genesis = send; state_blocks.push_back (send); } @@ -970,7 +970,7 @@ TEST (confirmation_height, dynamic_algorithm) auto transaction = node->store.tx_begin_write (); for (auto const & block : state_blocks) { - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *block)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, block)); } } @@ -1028,10 +1028,10 @@ TEST (confirmation_height, dynamic_algorithm_no_transition_while_pending) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_genesis)) - .build_shared (); + .build (); latest_genesis = send->hash (); state_blocks.push_back (send); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); ++num; }; @@ -1116,7 +1116,7 @@ TEST (confirmation_height, many_accounts_send_receive_self) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_genesis)) .build (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); auto open = builder .open () .source (send->hash ()) @@ -1124,8 +1124,8 @@ TEST (confirmation_height, many_accounts_send_receive_self) .account (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *open)); + .build (); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, open)); open_blocks.push_back (std::move (open)); latest_genesis = send->hash (); } @@ -1161,14 +1161,14 @@ TEST (confirmation_height, many_accounts_send_receive_self) .balance (1) .sign (keypair.prv, keypair.pub) .work (*system.work.generate (open_block->hash ())) - .build_shared ()); + .build ()); receive_blocks.emplace_back (builder .receive () .previous (send_blocks.back ()->hash ()) .source (send_blocks.back ()->hash ()) .sign (keypair.prv, keypair.pub) .work (*system.work.generate (send_blocks.back ()->hash ())) - .build_shared ()); + .build ()); } // Now send and receive to self @@ -1263,7 +1263,7 @@ TEST (confirmation_height, many_accounts_send_receive_self_no_elections) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (latest_genesis)) .build (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send)); auto open = builder .open () .source (send->hash ()) @@ -1271,8 +1271,8 @@ TEST (confirmation_height, many_accounts_send_receive_self_no_elections) .account (key.pub) .sign (key.prv, key.pub) .work (*pool.generate (key.pub)) - .build_shared (); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *open)); + .build (); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, open)); open_blocks.push_back (std::move (open)); latest_genesis = send->hash (); } @@ -1307,17 +1307,17 @@ TEST (confirmation_height, many_accounts_send_receive_self_no_elections) .balance (1) .sign (keypair.prv, keypair.pub) .work (*system.work.generate (open_block->hash ())) - .build_shared ()); + .build ()); receive_blocks.emplace_back (builder .receive () .previous (send_blocks.back ()->hash ()) .source (send_blocks.back ()->hash ()) .sign (keypair.prv, keypair.pub) .work (*system.work.generate (send_blocks.back ()->hash ())) - .build_shared ()); + .build ()); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *send_blocks.back ())); - ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, *receive_blocks.back ())); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, send_blocks.back ())); + ASSERT_EQ (nano::block_status::progress, ledger.process (transaction, receive_blocks.back ())); } } @@ -1523,7 +1523,7 @@ TEST (telemetry, under_load) .link (key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest_genesis)) - .build_shared (); + .build (); node->process_active (send); latest_genesis = send->hash (); auto open = builder @@ -1535,7 +1535,7 @@ TEST (telemetry, under_load) .link (send->hash ()) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); node->process_active (open); auto latest_key = open->hash (); @@ -1553,7 +1553,7 @@ TEST (telemetry, under_load) .link (key1.pub) .sign (keypair.prv, keypair.pub) .work (*system.work.generate (latest_l)) - .build_shared (); + .build (); latest_l = send->hash (); node->process_active (send); } @@ -1688,7 +1688,7 @@ TEST (telemetry, many_nodes) for (auto node : system.nodes) { auto transaction (node->store.tx_begin_write ()); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); } // This is the node which will request metrics from all other nodes @@ -1788,7 +1788,7 @@ TEST (node, mass_epoch_upgrader) .build (ec); ASSERT_FALSE (ec); ASSERT_NE (nullptr, block); - ASSERT_EQ (nano::block_status::progress, node.process (*block)); + ASSERT_EQ (nano::block_status::progress, node.process (block)); latest = block->hash (); info.pending_hash = block->hash (); } @@ -1812,7 +1812,7 @@ TEST (node, mass_epoch_upgrader) .build (ec); ASSERT_FALSE (ec); ASSERT_NE (nullptr, block); - ASSERT_EQ (nano::block_status::progress, node.process (*block)); + ASSERT_EQ (nano::block_status::progress, node.process (block)); } ASSERT_EQ (1 + total_accounts + opened.size (), node.ledger.cache.block_count); ASSERT_EQ (1 + opened.size (), node.ledger.cache.account_count); @@ -2042,7 +2042,7 @@ TEST (node, aggressive_flooding) { for (auto const & block : genesis_blocks) { - auto process_result (node_wallet.first->process (*block)); + auto process_result (node_wallet.first->process (block)); ASSERT_TRUE (nano::block_status::progress == process_result || nano::block_status::old == process_result); } ASSERT_EQ (node1.latest (nano::dev::genesis_key.pub), node_wallet.first->latest (nano::dev::genesis_key.pub)); @@ -2146,7 +2146,7 @@ TEST (node, wallet_create_block_confirm_conflicts) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) .build (); - ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, *send)); + ASSERT_EQ (nano::block_status::progress, node->ledger.process (transaction, send)); latest = send->hash (); } } diff --git a/nano/slow_test/vote_cache.cpp b/nano/slow_test/vote_cache.cpp index 05b5b66ed7..3c4a7ccb40 100644 --- a/nano/slow_test/vote_cache.cpp +++ b/nano/slow_test/vote_cache.cpp @@ -26,7 +26,7 @@ nano::keypair setup_rep (nano::test::system & system, nano::node & node, nano::u .balance (balance - amount) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto open = builder .open () @@ -35,7 +35,7 @@ nano::keypair setup_rep (nano::test::system & system, nano::node & node, nano::u .account (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); EXPECT_TRUE (nano::test::process (node, { send, open })); EXPECT_TRUE (nano::test::start_elections (system, node, { send, open }, true)); @@ -81,7 +81,7 @@ std::vector> setup_blocks (nano::test::system & sys .balance (balance) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto open = builder .open () @@ -90,7 +90,7 @@ std::vector> setup_blocks (nano::test::system & sys .account (key.pub) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); latest = send->hash (); diff --git a/nano/test_common/chains.cpp b/nano/test_common/chains.cpp index dc6123792a..e7a745a33f 100644 --- a/nano/test_common/chains.cpp +++ b/nano/test_common/chains.cpp @@ -23,7 +23,7 @@ nano::block_list_t nano::test::setup_chain (nano::test::system & system, nano::n .link (throwaway.pub) .sign (target.prv, target.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); latest = send->hash (); @@ -63,7 +63,7 @@ std::vector> nano::test::setup_chai .link (key.pub) .sign (source.prv, source.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto open = builder .state () @@ -74,7 +74,7 @@ std::vector> nano::test::setup_chai .link (send->hash ()) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); latest = send->hash (); @@ -120,7 +120,7 @@ nano::block_list_t nano::test::setup_independent_blocks (nano::test::system & sy .link (key.pub) .sign (source.prv, source.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); latest = send->hash (); @@ -133,7 +133,7 @@ nano::block_list_t nano::test::setup_independent_blocks (nano::test::system & sy .link (send->hash ()) .sign (key.prv, key.pub) .work (*system.work.generate (key.pub)) - .build_shared (); + .build (); EXPECT_TRUE (nano::test::process (node, { send, open })); EXPECT_TIMELY (5s, nano::test::exists (node, { send, open })); // Ensure blocks are in the ledger @@ -162,7 +162,7 @@ std::pair, std::shared_ptr> nano::test .link (dest.pub) .sign (source.prv, source.pub) .work (*system.work.generate (latest)) - .build_shared (); + .build (); auto open = nano::block_builder () .state () @@ -173,7 +173,7 @@ std::pair, std::shared_ptr> nano::test .link (send->hash ()) .sign (dest.prv, dest.pub) .work (*system.work.generate (dest.pub)) - .build_shared (); + .build (); EXPECT_TRUE (nano::test::process (node, { send, open })); EXPECT_TRUE (nano::test::start_elections (system, node, { send, open }, force_confirm)); diff --git a/nano/test_common/ledger.cpp b/nano/test_common/ledger.cpp index 235367453e..063000f33e 100644 --- a/nano/test_common/ledger.cpp +++ b/nano/test_common/ledger.cpp @@ -12,7 +12,7 @@ nano::test::context::ledger_context::ledger_context (std::dequeinitialize (tx, ledger_m.cache, ledger_m.constants); for (auto const & i : blocks_m) { - auto process_result = ledger_m.process (tx, *i); + auto process_result = ledger_m.process (tx, i); debug_assert (process_result == nano::block_status::progress); } } @@ -56,7 +56,7 @@ auto nano::test::context::ledger_send_receive () -> ledger_context .link (nano::dev::genesis_key.pub) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); blocks.push_back (send); auto receive = builder.state () .make_block () @@ -67,7 +67,7 @@ auto nano::test::context::ledger_send_receive () -> ledger_context .link (send->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send->hash ())) - .build_shared (); + .build (); blocks.push_back (receive); return ledger_context{ std::move (blocks) }; } @@ -84,7 +84,7 @@ auto nano::test::context::ledger_send_receive_legacy () -> ledger_context .balance (nano::dev::constants.genesis_amount - 1) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (nano::dev::genesis->hash ())) - .build_shared (); + .build (); blocks.push_back (send); auto receive = builder.receive () .make_block () @@ -92,7 +92,7 @@ auto nano::test::context::ledger_send_receive_legacy () -> ledger_context .source (send->hash ()) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*pool.generate (send->hash ())) - .build_shared (); + .build (); blocks.push_back (receive); return ledger_context{ std::move (blocks) }; } diff --git a/nano/test_common/system.cpp b/nano/test_common/system.cpp index a3ea7b5176..37e1376253 100644 --- a/nano/test_common/system.cpp +++ b/nano/test_common/system.cpp @@ -40,7 +40,7 @@ std::shared_ptr nano::test::system::add_node (nano::node_config cons auto node (std::make_shared (io_ctx, nano::unique_path (), node_config_a, work, node_flags_a, node_sequence++)); for (auto i : initialization_blocks) { - auto result = node->ledger.process (node->store.tx_begin_write (), *i); + auto result = node->ledger.process (node->store.tx_begin_write (), i); debug_assert (result == nano::block_status::progress); } debug_assert (!node->init_error ()); @@ -192,7 +192,7 @@ void nano::test::system::ledger_initialization_set (std::vector c .balance (balance) .sign (nano::dev::genesis_key.prv, nano::dev::genesis_key.pub) .work (*work.generate (previous)); - initialization_blocks.emplace_back (builder.build_shared ()); + initialization_blocks.emplace_back (builder.build ()); previous = initialization_blocks.back ()->hash (); builder.make_block (); builder.account (i.pub) @@ -202,7 +202,7 @@ void nano::test::system::ledger_initialization_set (std::vector c .balance (amount) .sign (i.prv, i.pub) .work (*work.generate (i.pub)); - initialization_blocks.emplace_back (builder.build_shared ()); + initialization_blocks.emplace_back (builder.build ()); } } @@ -239,7 +239,7 @@ uint64_t nano::test::system::work_generate_limited (nano::block_hash const & roo /** Initiate an epoch upgrade. Writes the epoch block into the ledger and leaves it to * node background processes (e.g. frontiers confirmation) to cement the block. */ -std::unique_ptr nano::test::upgrade_epoch (nano::work_pool & pool_a, nano::ledger & ledger_a, nano::epoch epoch_a) +std::shared_ptr nano::test::upgrade_epoch (nano::work_pool & pool_a, nano::ledger & ledger_a, nano::epoch epoch_a) { auto transaction (ledger_a.store.tx_begin_write ()); auto dev_genesis_key = nano::dev::genesis_key; @@ -262,13 +262,13 @@ std::unique_ptr nano::test::upgrade_epoch (nano::work_pool & bool error{ true }; if (!ec && epoch) { - error = ledger_a.process (transaction, *epoch) != nano::block_status::progress; + error = ledger_a.process (transaction, epoch) != nano::block_status::progress; } return !error ? std::move (epoch) : nullptr; } -std::unique_ptr nano::test::system::upgrade_genesis_epoch (nano::node & node_a, nano::epoch const epoch_a) +std::shared_ptr nano::test::system::upgrade_genesis_epoch (nano::node & node_a, nano::epoch const epoch_a) { return upgrade_epoch (work, node_a.ledger, epoch_a); } diff --git a/nano/test_common/system.hpp b/nano/test_common/system.hpp index 1f6f0fa660..4230742e90 100644 --- a/nano/test_common/system.hpp +++ b/nano/test_common/system.hpp @@ -38,7 +38,7 @@ namespace test void generate_receive (nano::node &); void generate_send_new (nano::node &, std::vector &); void generate_send_existing (nano::node &, std::vector &); - std::unique_ptr upgrade_genesis_epoch (nano::node &, nano::epoch const); + std::shared_ptr upgrade_genesis_epoch (nano::node &, nano::epoch const); std::shared_ptr wallet (size_t); nano::account account (store::transaction const &, size_t); /** Generate work with difficulty between \p min_difficulty_a (inclusive) and \p max_difficulty_a (exclusive) */ @@ -85,7 +85,7 @@ namespace test std::vector> initialization_blocks; }; - std::unique_ptr upgrade_epoch (nano::work_pool &, nano::ledger &, nano::epoch); + std::shared_ptr upgrade_epoch (nano::work_pool &, nano::ledger &, nano::epoch); void cleanup_dev_directories_on_exit (); } } diff --git a/nano/test_common/testutil.cpp b/nano/test_common/testutil.cpp index d08ca37b5f..9d6d5bb76e 100644 --- a/nano/test_common/testutil.cpp +++ b/nano/test_common/testutil.cpp @@ -64,7 +64,7 @@ bool nano::test::process (nano::node & node, std::vector