From ede7fad346f53c4de15aac8c6fec0f7179dad236 Mon Sep 17 00:00:00 2001 From: clemahieu Date: Fri, 17 Aug 2018 13:52:53 +0100 Subject: [PATCH] Changing parent to a default argument as we don't use nested transactions. --- rai/core_test/block_store.cpp | 108 +++++++-------- rai/core_test/gap_cache.cpp | 12 +- rai/core_test/ledger.cpp | 206 ++++++++++++++-------------- rai/core_test/network.cpp | 10 +- rai/core_test/node.cpp | 80 +++++------ rai/core_test/processor_service.cpp | 4 +- rai/core_test/rpc.cpp | 52 +++---- rai/core_test/versioning.cpp | 4 +- rai/core_test/wallet.cpp | 104 +++++++------- rai/core_test/wallets.cpp | 2 +- rai/node/bootstrap.cpp | 22 +-- rai/node/cli.cpp | 30 ++-- rai/node/lmdb.cpp | 2 +- rai/node/lmdb.hpp | 2 +- rai/node/node.cpp | 52 +++---- rai/node/rpc.cpp | 120 ++++++++-------- rai/node/testing.cpp | 10 +- rai/node/wallet.cpp | 44 +++--- rai/qt/qt.cpp | 48 +++---- rai/qt_test/qt.cpp | 58 ++++---- rai/rai_node/entry.cpp | 6 +- rai/rai_wallet/entry.cpp | 2 +- rai/secure/blockstore.cpp | 4 +- rai/secure/ledger.cpp | 6 +- rai/slow_test/node.cpp | 16 +-- 25 files changed, 502 insertions(+), 502 deletions(-) diff --git a/rai/core_test/block_store.cpp b/rai/core_test/block_store.cpp index c4fb39d3..43a074aa 100644 --- a/rai/core_test/block_store.cpp +++ b/rai/core_test/block_store.cpp @@ -21,7 +21,7 @@ TEST (block_store, add_item) ASSERT_TRUE (!init); rai::open_block block (0, 1, 0, rai::keypair ().prv, 0, 0); rai::uint256_union hash1 (block.hash ()); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); auto latest1 (store.block_get (transaction, hash1)); ASSERT_EQ (nullptr, latest1); ASSERT_FALSE (store.block_exists (transaction, hash1)); @@ -45,7 +45,7 @@ TEST (block_store, add_nonempty_block) rai::open_block block (0, 1, 0, rai::keypair ().prv, 0, 0); rai::uint256_union hash1 (block.hash ()); block.signature = rai::sign_message (key1.prv, key1.pub, hash1); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); auto latest1 (store.block_get (transaction, hash1)); ASSERT_EQ (nullptr, latest1); store.block_put (transaction, hash1, block); @@ -63,7 +63,7 @@ TEST (block_store, add_two_items) rai::open_block block (0, 1, 1, rai::keypair ().prv, 0, 0); rai::uint256_union hash1 (block.hash ()); block.signature = rai::sign_message (key1.prv, key1.pub, hash1); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); auto latest1 (store.block_get (transaction, hash1)); ASSERT_EQ (nullptr, latest1); rai::open_block block2 (0, 1, 3, rai::keypair ().prv, 0, 0); @@ -91,7 +91,7 @@ TEST (block_store, add_receive) rai::keypair key1; rai::keypair key2; rai::open_block block1 (0, 1, 0, rai::keypair ().prv, 0, 0); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.block_put (transaction, block1.hash (), block1); rai::receive_block block (block1.hash (), 1, rai::keypair ().prv, 2, 3); rai::block_hash hash1 (block.hash ()); @@ -111,7 +111,7 @@ TEST (block_store, add_pending) rai::keypair key1; rai::pending_key key2 (0, 0); rai::pending_info pending1; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); ASSERT_TRUE (store.pending_get (transaction, key2, pending1)); store.pending_put (transaction, key2, pending1); rai::pending_info pending2; @@ -126,7 +126,7 @@ TEST (block_store, pending_iterator) bool init (false); rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); ASSERT_EQ (store.pending_end (), store.pending_begin (transaction)); store.pending_put (transaction, rai::pending_key (1, 2), { 2, 3, rai::epoch::epoch_1 }); auto current (store.pending_begin (transaction)); @@ -147,7 +147,7 @@ TEST (block_store, genesis) ASSERT_TRUE (!init); rai::genesis genesis; auto hash (genesis.hash ()); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::account_info info; ASSERT_FALSE (store.account_get (transaction, rai::genesis_account, info)); @@ -169,7 +169,7 @@ TEST (representation, changes) rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); rai::keypair key1; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); ASSERT_EQ (0, store.representation_get (transaction, key1.pub)); store.representation_put (transaction, key1.pub, 1); ASSERT_EQ (1, store.representation_get (transaction, key1.pub)); @@ -183,7 +183,7 @@ TEST (bootstrap, simple) rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); auto block1 (std::make_shared (0, 1, 2, rai::keypair ().prv, 4, 5)); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); auto block2 (store.unchecked_get (transaction, block1->previous ())); ASSERT_TRUE (block2.empty ()); store.unchecked_put (transaction, block1->previous (), block1); @@ -201,7 +201,7 @@ TEST (unchecked, multiple) rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); auto block1 (std::make_shared (4, 1, 2, rai::keypair ().prv, 4, 5)); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); auto block2 (store.unchecked_get (transaction, block1->previous ())); ASSERT_TRUE (block2.empty ()); store.unchecked_put (transaction, block1->previous (), block1); @@ -218,7 +218,7 @@ TEST (unchecked, double_put) rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); auto block1 (std::make_shared (4, 1, 2, rai::keypair ().prv, 4, 5)); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); auto block2 (store.unchecked_get (transaction, block1->previous ())); ASSERT_TRUE (block2.empty ()); store.unchecked_put (transaction, block1->previous (), block1); @@ -233,7 +233,7 @@ TEST (checksum, simple) rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); rai::block_hash hash0 (0); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); ASSERT_TRUE (store.checksum_get (transaction, 0x100, 0x10, hash0)); rai::block_hash hash1 (0); store.checksum_put (transaction, 0x100, 0x10, hash1); @@ -250,7 +250,7 @@ TEST (block_store, empty_accounts) bool init (false); rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); auto begin (store.latest_begin (transaction)); auto end (store.latest_end ()); ASSERT_EQ (end, begin); @@ -262,7 +262,7 @@ TEST (block_store, one_block) rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); rai::open_block block1 (0, 1, 0, rai::keypair ().prv, 0, 0); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.block_put (transaction, block1.hash (), block1); ASSERT_TRUE (store.block_exists (transaction, block1.hash ())); } @@ -272,7 +272,7 @@ TEST (block_store, empty_bootstrap) bool init (false); rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); auto begin (store.unchecked_begin (transaction)); auto end (store.unchecked_end ()); ASSERT_EQ (end, begin); @@ -284,7 +284,7 @@ TEST (block_store, one_bootstrap) rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); auto block1 (std::make_shared (0, 1, 2, rai::keypair ().prv, 4, 5)); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.unchecked_put (transaction, block1->hash (), block1); store.flush (transaction); auto begin (store.unchecked_begin (transaction)); @@ -317,7 +317,7 @@ TEST (block_store, frontier_retrieval) ASSERT_TRUE (!init); rai::account account1 (0); rai::account_info info1 (0, 0, 0, 0, 0, 0, rai::epoch::epoch_0); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.account_put (transaction, account1, info1); rai::account_info info2; store.account_get (transaction, account1, info2); @@ -331,7 +331,7 @@ TEST (block_store, one_account) ASSERT_TRUE (!init); rai::account account (0); rai::block_hash hash (0); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.account_put (transaction, account, { hash, account, hash, 42, 100, 200, rai::epoch::epoch_0 }); auto begin (store.latest_begin (transaction)); auto end (store.latest_end ()); @@ -357,7 +357,7 @@ TEST (block_store, two_block) std::vector blocks; hashes.push_back (block1.hash ()); blocks.push_back (block1); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.block_put (transaction, hashes[0], block1); rai::open_block block2 (0, 1, 2, rai::keypair ().prv, 0, 0); hashes.push_back (block2.hash ()); @@ -376,7 +376,7 @@ TEST (block_store, two_account) rai::block_hash hash1 (2); rai::account account2 (3); rai::block_hash hash2 (4); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.account_put (transaction, account1, { hash1, account1, hash1, 42, 100, 300, rai::epoch::epoch_0 }); store.account_put (transaction, account2, { hash2, account2, hash2, 84, 200, 400, rai::epoch::epoch_0 }); auto begin (store.latest_begin (transaction)); @@ -409,7 +409,7 @@ TEST (block_store, latest_find) rai::block_hash hash1 (2); rai::account account2 (3); rai::block_hash hash2 (4); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.account_put (transaction, account1, { hash1, account1, hash1, 100, 0, 300, rai::epoch::epoch_0 }); store.account_put (transaction, account2, { hash2, account2, hash2, 200, 0, 400, rai::epoch::epoch_0 }); auto first (store.latest_begin (transaction)); @@ -464,7 +464,7 @@ TEST (block_store, pending_exists) ASSERT_TRUE (!init); rai::pending_key two (2, 0); rai::pending_info pending; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.pending_put (transaction, two, pending); rai::pending_key one (1, 0); ASSERT_FALSE (store.pending_exists (transaction, one)); @@ -477,7 +477,7 @@ TEST (block_store, latest_exists) ASSERT_TRUE (!init); rai::block_hash two (2); rai::account_info info; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.account_put (transaction, two, info); rai::block_hash one (1); ASSERT_FALSE (store.account_exists (transaction, one)); @@ -491,7 +491,7 @@ TEST (block_store, large_iteration) std::unordered_set accounts1; for (auto i (0); i < 1000; ++i) { - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::account account; rai::random_pool.GenerateBlock (account.bytes.data (), account.bytes.size ()); accounts1.insert (account); @@ -499,7 +499,7 @@ TEST (block_store, large_iteration) } std::unordered_set accounts2; rai::account previous (0); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); for (auto i (store.latest_begin (transaction, 0)), n (store.latest_end ()); i != n; ++i) { rai::account current (i->first); @@ -515,7 +515,7 @@ TEST (block_store, frontier) bool init (false); rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::block_hash hash (100); rai::account account (200); ASSERT_TRUE (store.frontier_get (transaction, hash).is_zero ()); @@ -532,7 +532,7 @@ TEST (block_store, block_replace) ASSERT_TRUE (!init); rai::send_block send1 (0, 0, 0, rai::keypair ().prv, 0, 1); rai::send_block send2 (0, 0, 0, rai::keypair ().prv, 0, 2); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.block_put (transaction, 0, send1); store.block_put (transaction, 0, send2); auto block3 (store.block_get (transaction, 0)); @@ -545,11 +545,11 @@ TEST (block_store, block_count) bool init (false); rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); - ASSERT_EQ (0, store.block_count (rai::transaction (store.environment, nullptr, false)).sum ()); + ASSERT_EQ (0, store.block_count (rai::transaction (store.environment, false)).sum ()); rai::open_block block (0, 1, 0, rai::keypair ().prv, 0, 0); rai::uint256_union hash1 (block.hash ()); - store.block_put (rai::transaction (store.environment, nullptr, true), hash1, block); - ASSERT_EQ (1, store.block_count (rai::transaction (store.environment, nullptr, false)).sum ()); + store.block_put (rai::transaction (store.environment, true), hash1, block); + ASSERT_EQ (1, store.block_count (rai::transaction (store.environment, false)).sum ()); } TEST (block_store, account_count) @@ -557,10 +557,10 @@ TEST (block_store, account_count) bool init (false); rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); - ASSERT_EQ (0, store.account_count (rai::transaction (store.environment, nullptr, false))); + ASSERT_EQ (0, store.account_count (rai::transaction (store.environment, false))); rai::account account (200); - store.account_put (rai::transaction (store.environment, nullptr, true), account, rai::account_info ()); - ASSERT_EQ (1, store.account_count (rai::transaction (store.environment, nullptr, false))); + store.account_put (rai::transaction (store.environment, true), account, rai::account_info ()); + ASSERT_EQ (1, store.account_count (rai::transaction (store.environment, false))); } TEST (block_store, sequence_increment) @@ -571,7 +571,7 @@ TEST (block_store, sequence_increment) rai::keypair key1; rai::keypair key2; auto block1 (std::make_shared (0, 1, 0, rai::keypair ().prv, 0, 0)); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); auto vote1 (store.vote_generate (transaction, key1.pub, key1.prv, block1)); ASSERT_EQ (1, vote1->sequence); auto vote2 (store.vote_generate (transaction, key1.pub, key1.prv, block1)); @@ -602,7 +602,7 @@ TEST (block_store, upgrade_v2_v3) bool init (false); rai::block_store store (init, path); ASSERT_TRUE (!init); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::genesis genesis; auto hash (genesis.hash ()); store.initialize (transaction, genesis); @@ -630,7 +630,7 @@ TEST (block_store, upgrade_v2_v3) rai::block_store store (init, path); rai::stat stats; rai::ledger ledger (store, stats); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); ASSERT_TRUE (!init); ASSERT_LT (2, store.version_get (transaction)); ASSERT_EQ (rai::genesis_amount, ledger.weight (transaction, key1.pub)); @@ -650,7 +650,7 @@ TEST (block_store, upgrade_v3_v4) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.version_put (transaction, 3); rai::pending_info_v3 info (key1.pub, 100, key2.pub); auto status (mdb_put (transaction, store.pending_v0, rai::mdb_val (key3.pub), info.val (), 0)); @@ -660,7 +660,7 @@ TEST (block_store, upgrade_v3_v4) rai::block_store store (init, path); rai::stat stats; rai::ledger ledger (store, stats); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); ASSERT_FALSE (init); ASSERT_LT (3, store.version_get (transaction)); rai::pending_key key (key2.pub, key3.pub); @@ -681,7 +681,7 @@ TEST (block_store, upgrade_v4_v5) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::genesis genesis; rai::stat stats; rai::ledger ledger (store, stats); @@ -706,7 +706,7 @@ TEST (block_store, upgrade_v4_v5) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); ASSERT_EQ (hash, store.block_successor (transaction, genesis_hash)); } @@ -716,7 +716,7 @@ TEST (block_store, block_random) rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); auto block (store.block_random (transaction)); ASSERT_NE (nullptr, block); @@ -730,7 +730,7 @@ TEST (block_store, upgrade_v5_v6) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::genesis genesis; store.initialize (transaction, genesis); store.version_put (transaction, 5); @@ -743,7 +743,7 @@ TEST (block_store, upgrade_v5_v6) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); rai::account_info info; store.account_get (transaction, rai::test_genesis_key.pub, info); ASSERT_EQ (1, info.block_count); @@ -756,7 +756,7 @@ TEST (block_store, upgrade_v6_v7) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::genesis genesis; store.initialize (transaction, genesis); store.version_put (transaction, 6); @@ -768,7 +768,7 @@ TEST (block_store, upgrade_v6_v7) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); ASSERT_EQ (store.unchecked_end (), store.unchecked_begin (transaction)); } @@ -778,7 +778,7 @@ TEST (block_store, change_dupsort) auto path (rai::unique_path ()); bool init (false); rai::block_store store (init, path); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); ASSERT_EQ (0, mdb_drop (transaction, store.unchecked, 1)); ASSERT_EQ (0, mdb_dbi_open (transaction, "unchecked", MDB_CREATE, &store.unchecked)); auto send1 (std::make_shared (0, 0, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); @@ -823,7 +823,7 @@ TEST (block_store, upgrade_v7_v8) { bool init (false); rai::block_store store (init, path); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); ASSERT_EQ (0, mdb_drop (transaction, store.unchecked, 1)); ASSERT_EQ (0, mdb_dbi_open (transaction, "unchecked", MDB_CREATE, &store.unchecked)); store.version_put (transaction, 7); @@ -831,7 +831,7 @@ TEST (block_store, upgrade_v7_v8) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); auto send1 (std::make_shared (0, 0, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); auto send2 (std::make_shared (1, 0, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); store.unchecked_put (transaction, send1->hash (), send1); @@ -852,7 +852,7 @@ TEST (block_store, sequence_flush) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::keypair key1; auto send1 (std::make_shared (0, 0, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); auto vote1 (store.vote_generate (transaction, key1.pub, key1.prv, send1)); @@ -871,7 +871,7 @@ TEST (block_store, upgrade_v8_v9) { bool init (false); rai::block_store store (init, path); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); ASSERT_EQ (0, mdb_drop (transaction, store.vote, 1)); ASSERT_EQ (0, mdb_dbi_open (transaction, "sequence", MDB_CREATE, &store.vote)); uint64_t sequence (10); @@ -881,7 +881,7 @@ TEST (block_store, upgrade_v8_v9) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); ASSERT_LT (8, store.version_get (transaction)); auto vote (store.vote_get (transaction, key.pub)); ASSERT_NE (nullptr, vote); @@ -896,7 +896,7 @@ TEST (block_store, upgrade_v9_v10) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::genesis genesis; rai::stat stats; rai::ledger ledger (store, stats); @@ -925,7 +925,7 @@ TEST (block_store, upgrade_v9_v10) bool init (false); rai::block_store store (init, path); ASSERT_FALSE (init); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); ASSERT_LT (9, store.version_get (transaction)); rai::block_info block_info; store.block_info_get (transaction, hash, block_info); @@ -939,7 +939,7 @@ TEST (block_store, state_block) rai::block_store store (error, rai::unique_path ()); ASSERT_FALSE (error); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::state_block block1 (1, genesis.hash (), 3, 4, 6, key1.prv, key1.pub, 7); diff --git a/rai/core_test/gap_cache.cpp b/rai/core_test/gap_cache.cpp index 7a270d57..6ba9cfbc 100644 --- a/rai/core_test/gap_cache.cpp +++ b/rai/core_test/gap_cache.cpp @@ -9,7 +9,7 @@ TEST (gap_cache, add_new) rai::system system (24000, 1); rai::gap_cache cache (*system.nodes[0]); auto block1 (std::make_shared (0, 1, 2, rai::keypair ().prv, 4, 5)); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); cache.add (transaction, block1); } @@ -18,7 +18,7 @@ TEST (gap_cache, add_existing) rai::system system (24000, 1); rai::gap_cache cache (*system.nodes[0]); auto block1 (std::make_shared (0, 1, 2, rai::keypair ().prv, 4, 5)); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); cache.add (transaction, block1); auto existing1 (cache.blocks.get<1> ().find (block1->hash ())); ASSERT_NE (cache.blocks.get<1> ().end (), existing1); @@ -37,7 +37,7 @@ TEST (gap_cache, comparison) rai::system system (24000, 1); rai::gap_cache cache (*system.nodes[0]); auto block1 (std::make_shared (1, 0, 2, rai::keypair ().prv, 4, 5)); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); cache.add (transaction, block1); auto existing1 (cache.blocks.get<1> ().find (block1->hash ())); ASSERT_NE (cache.blocks.get<1> ().end (), existing1); @@ -60,7 +60,7 @@ TEST (gap_cache, gap_bootstrap) rai::keypair key; auto send (std::make_shared (latest, key.pub, rai::genesis_amount - 100, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.work.generate (latest))); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); ASSERT_EQ (rai::process_result::progress, system.nodes[0]->block_processor.process_receive_one (transaction, send).code); } ASSERT_EQ (rai::genesis_amount - 100, system.nodes[0]->balance (rai::genesis_account)); @@ -75,7 +75,7 @@ TEST (gap_cache, gap_bootstrap) { // The separate publish and vote system doesn't work very well here because it's instantly confirmed. // We help it get the block and vote out here. - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); system.nodes[0]->network.republish_block (transaction, latest_block); } while (system.nodes[1]->balance (rai::genesis_account) != rai::genesis_amount - 200) @@ -102,7 +102,7 @@ TEST (gap_cache, two_dependencies) system.nodes[0]->block_processor.add (send1, std::chrono::steady_clock::now ()); system.nodes[0]->block_processor.flush (); ASSERT_EQ (0, system.nodes[0]->gap_cache.blocks.size ()); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_TRUE (system.nodes[0]->store.block_exists (transaction, send1->hash ())); ASSERT_TRUE (system.nodes[0]->store.block_exists (transaction, send2->hash ())); ASSERT_TRUE (system.nodes[0]->store.block_exists (transaction, open->hash ())); diff --git a/rai/core_test/ledger.cpp b/rai/core_test/ledger.cpp index 7d048e47..80fec48a 100644 --- a/rai/core_test/ledger.cpp +++ b/rai/core_test/ledger.cpp @@ -26,7 +26,7 @@ TEST (ledger, empty) rai::stat stats; rai::ledger ledger (store, stats); rai::account account; - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); auto balance (ledger.account_balance (transaction, account)); ASSERT_TRUE (balance.is_zero ()); } @@ -40,7 +40,7 @@ TEST (ledger, genesis_balance) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); auto balance (ledger.account_balance (transaction, rai::genesis_account)); ASSERT_EQ (rai::genesis_amount, balance); @@ -70,7 +70,7 @@ TEST (ledger, checksum_persistence) max.qwords[3] = 0; max.qwords[3] = ~max.qwords[3]; rai::stat stats; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); { rai::ledger ledger (store, stats); rai::genesis genesis; @@ -87,7 +87,7 @@ TEST (system, system_genesis) rai::system system (24000, 2); for (auto & i : system.nodes) { - rai::transaction transaction (i->store.environment, nullptr, false); + rai::transaction transaction (i->store.environment, false); ASSERT_EQ (rai::genesis_amount, i->ledger.account_balance (transaction, rai::genesis_account)); } } @@ -100,7 +100,7 @@ TEST (ledger, process_send) ASSERT_TRUE (!init); rai::stat stats; rai::ledger ledger (store, stats); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::genesis genesis; store.initialize (transaction, genesis); rai::account_info info1; @@ -194,7 +194,7 @@ TEST (ledger, process_receive) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::account_info info1; ASSERT_FALSE (store.account_get (transaction, rai::test_genesis_key.pub, info1)); @@ -251,7 +251,7 @@ TEST (ledger, rollback_receiver) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::account_info info1; ASSERT_FALSE (store.account_get (transaction, rai::test_genesis_key.pub, info1)); @@ -289,7 +289,7 @@ TEST (ledger, rollback_representation) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key5; rai::change_block change1 (genesis.hash (), key5.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -342,7 +342,7 @@ TEST (ledger, receive_rollback) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::send_block send (genesis.hash (), rai::test_genesis_key.pub, rai::genesis_amount - rai::Gxrb_ratio, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send).code); @@ -359,7 +359,7 @@ TEST (ledger, process_duplicate) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::account_info info1; ASSERT_FALSE (store.account_get (transaction, rai::test_genesis_key.pub, info1)); @@ -381,7 +381,7 @@ TEST (ledger, representative_genesis) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); auto latest (ledger.latest (transaction, rai::test_genesis_key.pub)); ASSERT_FALSE (latest.is_zero ()); @@ -396,7 +396,7 @@ TEST (ledger, weight) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); ASSERT_EQ (rai::genesis_amount, ledger.weight (transaction, rai::genesis_account)); } @@ -410,7 +410,7 @@ TEST (ledger, representative_change) rai::ledger ledger (store, stats); rai::keypair key2; rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); ASSERT_EQ (rai::genesis_amount, ledger.weight (transaction, rai::test_genesis_key.pub)); ASSERT_EQ (0, ledger.weight (transaction, key2.pub)); @@ -449,7 +449,7 @@ TEST (ledger, send_fork) rai::keypair key2; rai::keypair key3; rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::account_info info1; ASSERT_FALSE (store.account_get (transaction, rai::test_genesis_key.pub, info1)); @@ -469,7 +469,7 @@ TEST (ledger, receive_fork) rai::keypair key2; rai::keypair key3; rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::account_info info1; ASSERT_FALSE (store.account_get (transaction, rai::test_genesis_key.pub, info1)); @@ -495,7 +495,7 @@ TEST (ledger, open_fork) rai::keypair key2; rai::keypair key3; rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::account_info info1; ASSERT_FALSE (store.account_get (transaction, rai::test_genesis_key.pub, info1)); @@ -513,7 +513,7 @@ TEST (ledger, checksum_single) rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::stat stats; rai::ledger ledger (store, stats); store.initialize (transaction, genesis); @@ -533,7 +533,7 @@ TEST (ledger, checksum_two) rai::block_store store (init, rai::unique_path ()); ASSERT_TRUE (!init); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::stat stats; rai::ledger ledger (store, stats); store.initialize (transaction, genesis); @@ -555,7 +555,7 @@ TEST (ledger, DISABLED_checksum_range) ASSERT_TRUE (!init); rai::stat stats; rai::ledger ledger (store, stats); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); rai::checksum check1 (ledger.checksum (transaction, 0, std::numeric_limits::max ())); ASSERT_TRUE (check1.is_zero ()); rai::block_hash hash1 (42); @@ -574,7 +574,7 @@ TEST (system, generate_send_existing) auto send_block (system.wallet (0)->send_action (rai::genesis_account, stake_preserver.pub, rai::genesis_amount / 3 * 2, true)); rai::account_info info1; { - rai::transaction transaction (system.wallet (0)->store.environment, nullptr, false); + rai::transaction transaction (system.wallet (0)->store.environment, false); ASSERT_FALSE (system.nodes[0]->store.account_get (transaction, rai::test_genesis_key.pub, info1)); } std::vector accounts; @@ -582,7 +582,7 @@ TEST (system, generate_send_existing) system.generate_send_existing (*system.nodes[0], accounts); // Have stake_preserver receive funds after generate_send_existing so it isn't chosen as the destination { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); auto open_block (std::make_shared (send_block->hash (), rai::genesis_account, stake_preserver.pub, stake_preserver.prv, stake_preserver.pub, 0)); system.nodes[0]->work_generate_blocking (*open_block); ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (transaction, *open_block).code); @@ -590,7 +590,7 @@ TEST (system, generate_send_existing) ASSERT_GT (system.nodes[0]->balance (stake_preserver.pub), system.nodes[0]->balance (rai::genesis_account)); rai::account_info info2; { - rai::transaction transaction (system.wallet (0)->store.environment, nullptr, false); + rai::transaction transaction (system.wallet (0)->store.environment, false); ASSERT_FALSE (system.nodes[0]->store.account_get (transaction, rai::test_genesis_key.pub, info2)); } ASSERT_NE (info1.head, info2.head); @@ -598,13 +598,13 @@ TEST (system, generate_send_existing) while (info2.block_count < info1.block_count + 2) { ASSERT_NO_ERROR (system.poll ()); - rai::transaction transaction (system.wallet (0)->store.environment, nullptr, false); + rai::transaction transaction (system.wallet (0)->store.environment, false); ASSERT_FALSE (system.nodes[0]->store.account_get (transaction, rai::test_genesis_key.pub, info2)); } ASSERT_EQ (info1.block_count + 2, info2.block_count); ASSERT_EQ (info2.balance, rai::genesis_amount / 3); { - rai::transaction transaction (system.wallet (0)->store.environment, nullptr, false); + rai::transaction transaction (system.wallet (0)->store.environment, false); ASSERT_NE (system.nodes[0]->ledger.amount (transaction, info2.head), 0); } system.stop (); @@ -617,7 +617,7 @@ TEST (system, generate_send_new) rai::thread_runner runner (system.service, system.nodes[0]->config.io_threads); system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); auto iterator1 (system.nodes[0]->store.latest_begin (transaction)); ASSERT_NE (system.nodes[0]->store.latest_end (), iterator1); ++iterator1; @@ -626,7 +626,7 @@ TEST (system, generate_send_new) rai::keypair stake_preserver; auto send_block (system.wallet (0)->send_action (rai::genesis_account, stake_preserver.pub, rai::genesis_amount / 3 * 2, true)); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); auto open_block (std::make_shared (send_block->hash (), rai::genesis_account, stake_preserver.pub, stake_preserver.prv, stake_preserver.pub, 0)); system.nodes[0]->work_generate_blocking (*open_block); ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (transaction, *open_block).code); @@ -637,7 +637,7 @@ TEST (system, generate_send_new) system.generate_send_new (*system.nodes[0], accounts); rai::account new_account (0); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); auto iterator2 (system.wallet (0)->store.begin (transaction)); if (rai::uint256_union (iterator2->first) != rai::test_genesis_key.pub) { @@ -670,7 +670,7 @@ TEST (ledger, representation) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); ASSERT_EQ (rai::genesis_amount, store.representation_get (transaction, rai::test_genesis_key.pub)); rai::keypair key2; @@ -743,7 +743,7 @@ TEST (ledger, double_open) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key2; rai::send_block send1 (genesis.hash (), key2.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -762,7 +762,7 @@ TEST (ledegr, double_receive) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key2; rai::send_block send1 (genesis.hash (), key2.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -780,7 +780,7 @@ TEST (votes, check_signature) rai::genesis genesis; rai::keypair key1; auto send1 (std::make_shared (genesis.hash (), key1.pub, rai::genesis_amount - 100, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); - rai::transaction transaction (node1.store.environment, nullptr, true); + rai::transaction transaction (node1.store.environment, true); ASSERT_EQ (rai::process_result::progress, node1.ledger.process (transaction, *send1).code); auto node_l (system.nodes[0]); node1.active.start (send1); @@ -802,7 +802,7 @@ TEST (votes, add_one) rai::keypair key1; auto send1 (std::make_shared (genesis.hash (), key1.pub, rai::genesis_amount - 100, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); { - rai::transaction transaction (node1.store.environment, nullptr, true); + rai::transaction transaction (node1.store.environment, true); ASSERT_EQ (rai::process_result::progress, node1.ledger.process (transaction, *send1).code); } auto node_l (system.nodes[0]); @@ -817,7 +817,7 @@ TEST (votes, add_one) auto existing1 (votes1->last_votes.find (rai::test_genesis_key.pub)); ASSERT_NE (votes1->last_votes.end (), existing1); ASSERT_EQ (send1->hash (), existing1->second.hash); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); auto winner (*votes1->tally (transaction).begin ()); ASSERT_EQ (*send1, *winner.second); ASSERT_EQ (rai::genesis_amount - 100, winner.first); @@ -831,7 +831,7 @@ TEST (votes, add_two) rai::keypair key1; auto send1 (std::make_shared (genesis.hash (), key1.pub, rai::genesis_amount - 100, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); { - rai::transaction transaction (node1.store.environment, nullptr, true); + rai::transaction transaction (node1.store.environment, true); ASSERT_EQ (rai::process_result::progress, node1.ledger.process (transaction, *send1).code); } auto node_l (system.nodes[0]); @@ -848,7 +848,7 @@ TEST (votes, add_two) ASSERT_EQ (send1->hash (), votes1->last_votes[rai::test_genesis_key.pub].hash); ASSERT_NE (votes1->last_votes.end (), votes1->last_votes.find (key2.pub)); ASSERT_EQ (send2->hash (), votes1->last_votes[key2.pub].hash); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); auto winner (*votes1->tally (transaction).begin ()); ASSERT_EQ (*send1, *winner.second); } @@ -862,7 +862,7 @@ TEST (votes, add_existing) rai::keypair key1; auto send1 (std::make_shared (genesis.hash (), key1.pub, rai::genesis_amount - rai::Gxrb_ratio, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); { - rai::transaction transaction (node1.store.environment, nullptr, true); + rai::transaction transaction (node1.store.environment, true); ASSERT_EQ (rai::process_result::progress, node1.ledger.process (transaction, *send1).code); } auto node_l (system.nodes[0]); @@ -887,7 +887,7 @@ TEST (votes, add_existing) ASSERT_EQ (2, votes1->last_votes.size ()); ASSERT_NE (votes1->last_votes.end (), votes1->last_votes.find (rai::test_genesis_key.pub)); ASSERT_EQ (send2->hash (), votes1->last_votes[rai::test_genesis_key.pub].hash); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); auto winner (*votes1->tally (transaction).begin ()); ASSERT_EQ (*send2, *winner.second); } @@ -900,7 +900,7 @@ TEST (votes, add_old) rai::genesis genesis; rai::keypair key1; auto send1 (std::make_shared (genesis.hash (), key1.pub, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); - rai::transaction transaction (node1.store.environment, nullptr, true); + rai::transaction transaction (node1.store.environment, true); ASSERT_EQ (rai::process_result::progress, node1.ledger.process (transaction, *send1).code); auto node_l (system.nodes[0]); node1.active.start (send1); @@ -929,7 +929,7 @@ TEST (votes, add_old_different_account) auto send1 (std::make_shared (genesis.hash (), key1.pub, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); auto send2 (std::make_shared (send1->hash (), key1.pub, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); { - rai::transaction transaction (node1.store.environment, nullptr, true); + rai::transaction transaction (node1.store.environment, true); ASSERT_EQ (rai::process_result::progress, node1.ledger.process (transaction, *send1).code); ASSERT_EQ (rai::process_result::progress, node1.ledger.process (transaction, *send2).code); } @@ -941,7 +941,7 @@ TEST (votes, add_old_different_account) ASSERT_EQ (1, votes1->last_votes.size ()); ASSERT_EQ (1, votes2->last_votes.size ()); auto vote1 (std::make_shared (rai::test_genesis_key.pub, rai::test_genesis_key.prv, 2, send1)); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); auto vote_result1 (node1.vote_processor.vote_blocking (transaction, vote1, node1.network.endpoint ())); ASSERT_EQ (rai::vote_code::vote, vote_result1); ASSERT_EQ (2, votes1->last_votes.size ()); @@ -969,7 +969,7 @@ TEST (votes, add_cooldown) rai::genesis genesis; rai::keypair key1; auto send1 (std::make_shared (genesis.hash (), key1.pub, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); - rai::transaction transaction (node1.store.environment, nullptr, true); + rai::transaction transaction (node1.store.environment, true); ASSERT_EQ (rai::process_result::progress, node1.ledger.process (transaction, *send1).code); auto node_l (system.nodes[0]); node1.active.start (send1); @@ -994,7 +994,7 @@ TEST (ledger, successor) rai::keypair key1; rai::genesis genesis; rai::send_block send1 (genesis.hash (), key1.pub, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (transaction, send1).code); ASSERT_EQ (send1, *system.nodes[0]->ledger.successor (transaction, genesis.hash ())); ASSERT_EQ (*genesis.open, *system.nodes[0]->ledger.successor (transaction, genesis.open->root ())); @@ -1009,7 +1009,7 @@ TEST (ledger, fail_change_old) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::change_block block (genesis.hash (), key1.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1027,7 +1027,7 @@ TEST (ledger, fail_change_gap_previous) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::change_block block (1, key1.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1043,7 +1043,7 @@ TEST (ledger, fail_change_bad_signature) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::change_block block (genesis.hash (), key1.pub, rai::keypair ().prv, 0, 0); @@ -1059,7 +1059,7 @@ TEST (ledger, fail_change_fork) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::change_block block1 (genesis.hash (), key1.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1079,7 +1079,7 @@ TEST (ledger, fail_send_old) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1097,7 +1097,7 @@ TEST (ledger, fail_send_gap_previous) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block (1, key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1113,7 +1113,7 @@ TEST (ledger, fail_send_bad_signature) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block (genesis.hash (), key1.pub, 1, rai::keypair ().prv, 0, 0); @@ -1129,7 +1129,7 @@ TEST (ledger, fail_send_negative_spend) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1147,7 +1147,7 @@ TEST (ledger, fail_send_fork) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1165,7 +1165,7 @@ TEST (ledger, fail_open_old) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1183,7 +1183,7 @@ TEST (ledger, fail_open_gap_source) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::open_block block2 (1, 1, key1.pub, key1.prv, key1.pub, 0); @@ -1199,7 +1199,7 @@ TEST (ledger, fail_open_bad_signature) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1217,7 +1217,7 @@ TEST (ledger, fail_open_fork_previous) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1238,7 +1238,7 @@ TEST (ledger, fail_open_account_mismatch) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1256,7 +1256,7 @@ TEST (ledger, fail_receive_old) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1278,7 +1278,7 @@ TEST (ledger, fail_receive_gap_source) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1303,7 +1303,7 @@ TEST (ledger, fail_receive_overreceive) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1325,7 +1325,7 @@ TEST (ledger, fail_receive_bad_signature) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1350,7 +1350,7 @@ TEST (ledger, fail_receive_gap_previous_opened) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1375,7 +1375,7 @@ TEST (ledger, fail_receive_gap_previous_unopened) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1397,7 +1397,7 @@ TEST (ledger, fail_receive_fork_previous) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 1, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1426,7 +1426,7 @@ TEST (ledger, fail_receive_received_source) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key1; rai::send_block block1 (genesis.hash (), key1.pub, 2, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1461,7 +1461,7 @@ TEST (ledger, latest_empty) rai::stat stats; rai::ledger ledger (store, stats); rai::keypair key; - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); auto latest (ledger.latest (transaction, key.pub)); ASSERT_TRUE (latest.is_zero ()); } @@ -1474,7 +1474,7 @@ TEST (ledger, latest_root) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key; ASSERT_EQ (key.pub, ledger.latest_root (transaction, key.pub)); @@ -1492,7 +1492,7 @@ TEST (ledger, change_representative_move_representation) rai::stat stats; rai::ledger ledger (store, stats); rai::keypair key1; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::genesis genesis; store.initialize (transaction, genesis); auto hash1 (genesis.hash ()); @@ -1516,7 +1516,7 @@ TEST (ledger, send_open_receive_rollback) ASSERT_TRUE (!init); rai::stat stats; rai::ledger ledger (store, stats); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::genesis genesis; store.initialize (transaction, genesis); rai::account_info info1; @@ -1578,26 +1578,26 @@ TEST (ledger, bootstrap_rep_weight) rai::keypair key2; rai::genesis genesis; { - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); ASSERT_FALSE (store.account_get (transaction, rai::test_genesis_key.pub, info1)); rai::send_block send (info1.head, key2.pub, std::numeric_limits::max () - 50, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ledger.process (transaction, send); } { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); ledger.bootstrap_weight_max_blocks = 3; ledger.bootstrap_weights[key2.pub] = 1000; ASSERT_EQ (1000, ledger.weight (transaction, key2.pub)); } { - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); ASSERT_FALSE (store.account_get (transaction, rai::test_genesis_key.pub, info1)); rai::send_block send (info1.head, key2.pub, std::numeric_limits::max () - 100, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ledger.process (transaction, send); } { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); ASSERT_EQ (0, ledger.weight (transaction, key2.pub)); } } @@ -1610,7 +1610,7 @@ TEST (ledger, block_destination_source) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair dest; rai::uint128_t balance (rai::genesis_amount); @@ -1655,7 +1655,7 @@ TEST (ledger, state_account) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -1670,7 +1670,7 @@ TEST (ledger, state_send_receive) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -1702,7 +1702,7 @@ TEST (ledger, state_receive) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::send_block send1 (genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -1732,7 +1732,7 @@ TEST (ledger, state_rep_change) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair rep; rai::state_block change1 (rai::genesis_account, genesis.hash (), rep.pub, rai::genesis_amount, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1755,7 +1755,7 @@ TEST (ledger, state_open) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, destination.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1789,7 +1789,7 @@ TEST (ledger, send_after_state_fail) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -1806,7 +1806,7 @@ TEST (ledger, receive_after_state_fail) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -1823,7 +1823,7 @@ TEST (ledger, change_after_state_fail) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -1840,7 +1840,7 @@ TEST (ledger, state_unreceivable_fail) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::send_block send1 (genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -1863,7 +1863,7 @@ TEST (ledger, state_receive_bad_amount_fail) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::send_block send1 (genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -1886,7 +1886,7 @@ TEST (ledger, state_no_link_amount_fail) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -1903,7 +1903,7 @@ TEST (ledger, state_receive_wrong_account_fail) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -1927,7 +1927,7 @@ TEST (ledger, state_open_state_fork) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, destination.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1947,7 +1947,7 @@ TEST (ledger, state_state_open_fork) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, destination.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1967,7 +1967,7 @@ TEST (ledger, state_open_previous_fail) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, destination.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1984,7 +1984,7 @@ TEST (ledger, state_open_source_fail) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, destination.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -2001,7 +2001,7 @@ TEST (ledger, state_send_change) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair rep; rai::state_block send1 (rai::genesis_account, genesis.hash (), rep.pub, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -2024,7 +2024,7 @@ TEST (ledger, state_receive_change) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -2056,7 +2056,7 @@ TEST (ledger, state_open_old) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, destination.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -2076,7 +2076,7 @@ TEST (ledger, state_receive_old) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, destination.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -2100,7 +2100,7 @@ TEST (ledger, state_rollback_send) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -2130,7 +2130,7 @@ TEST (ledger, state_rollback_receive) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -2155,7 +2155,7 @@ TEST (ledger, state_rollback_received_send) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key; rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, key.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -2181,7 +2181,7 @@ TEST (ledger, state_rep_change_rollback) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair rep; rai::state_block change1 (rai::genesis_account, genesis.hash (), rep.pub, rai::genesis_amount, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -2201,7 +2201,7 @@ TEST (ledger, state_open_rollback) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, destination.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -2226,7 +2226,7 @@ TEST (ledger, state_send_change_rollback) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair rep; rai::state_block send1 (rai::genesis_account, genesis.hash (), rep.pub, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -2246,7 +2246,7 @@ TEST (ledger, state_receive_change_rollback) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, rai::genesis_account, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); ASSERT_EQ (rai::process_result::progress, ledger.process (transaction, send1).code); @@ -2269,7 +2269,7 @@ TEST (ledger, epoch_blocks_general) rai::keypair epoch_key; rai::ledger ledger (store, stats, 123, epoch_key.pub); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::state_block epoch1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount, 123, epoch_key.prv, epoch_key.pub, 0); @@ -2315,7 +2315,7 @@ TEST (ledger, epoch_blocks_receive_upgrade) rai::keypair epoch_key; rai::ledger ledger (store, stats, 123, epoch_key.pub); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::state_block send1 (rai::genesis_account, genesis.hash (), rai::genesis_account, rai::genesis_amount - rai::Gxrb_ratio, destination.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -2355,7 +2355,7 @@ TEST (ledger, epoch_blocks_fork) rai::keypair epoch_key; rai::ledger ledger (store, stats, 123, epoch_key.pub); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair destination; rai::send_block send1 (genesis.hash (), rai::account (0), rai::genesis_amount, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); diff --git a/rai/core_test/network.cpp b/rai/core_test/network.cpp index 1a602d19..8ddf4713 100644 --- a/rai/core_test/network.cpp +++ b/rai/core_test/network.cpp @@ -151,7 +151,7 @@ TEST (network, send_discarded_publish) auto block (std::make_shared (1, 1, 2, rai::keypair ().prv, 4, system.work.generate (1))); rai::genesis genesis; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); system.nodes[0]->network.republish_block (transaction, block); ASSERT_EQ (genesis.hash (), system.nodes[0]->ledger.latest (transaction, rai::test_genesis_key.pub)); ASSERT_EQ (genesis.hash (), system.nodes[1]->latest (rai::test_genesis_key.pub)); @@ -161,7 +161,7 @@ TEST (network, send_discarded_publish) { ASSERT_NO_ERROR (system.poll ()); } - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_EQ (genesis.hash (), system.nodes[0]->ledger.latest (transaction, rai::test_genesis_key.pub)); ASSERT_EQ (genesis.hash (), system.nodes[1]->latest (rai::test_genesis_key.pub)); } @@ -172,7 +172,7 @@ TEST (network, send_invalid_publish) rai::genesis genesis; auto block (std::make_shared (1, 1, 20, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.work.generate (1))); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); system.nodes[0]->network.republish_block (transaction, block); ASSERT_EQ (genesis.hash (), system.nodes[0]->ledger.latest (transaction, rai::test_genesis_key.pub)); ASSERT_EQ (genesis.hash (), system.nodes[1]->latest (rai::test_genesis_key.pub)); @@ -182,7 +182,7 @@ TEST (network, send_invalid_publish) { ASSERT_NO_ERROR (system.poll ()); } - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_EQ (genesis.hash (), system.nodes[0]->ledger.latest (transaction, rai::test_genesis_key.pub)); ASSERT_EQ (genesis.hash (), system.nodes[1]->latest (rai::test_genesis_key.pub)); } @@ -325,7 +325,7 @@ TEST (network, receive_weight_change) rai::keypair key2; system.wallet (1)->insert_adhoc (key2.prv); { - rai::transaction transaction (system.nodes[1]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[1]->store.environment, true); system.wallet (1)->store.representative_set (transaction, key2.pub); } ASSERT_NE (nullptr, system.wallet (0)->send_action (rai::test_genesis_key.pub, key2.pub, system.nodes[0]->config.receive_minimum.number ())); diff --git a/rai/core_test/node.cpp b/rai/core_test/node.cpp index e6cdb808..ca2e703a 100644 --- a/rai/core_test/node.cpp +++ b/rai/core_test/node.cpp @@ -49,7 +49,7 @@ TEST (node, balance) { rai::system system (24000, 1); system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); ASSERT_EQ (std::numeric_limits::max (), system.nodes[0]->ledger.account_balance (transaction, rai::test_genesis_key.pub)); } @@ -58,7 +58,7 @@ TEST (node, representative) rai::system system (24000, 1); auto block1 (system.nodes[0]->representative (rai::test_genesis_key.pub)); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_TRUE (system.nodes[0]->ledger.store.block_exists (transaction, block1)); } rai::keypair key; @@ -341,7 +341,7 @@ TEST (node, unlock_search) rai::keypair key2; rai::uint128_t balance (system.nodes[0]->balance (rai::test_genesis_key.pub)); { - rai::transaction transaction (system.wallet (0)->store.environment, nullptr, true); + rai::transaction transaction (system.wallet (0)->store.environment, true); system.wallet (0)->store.rekey (transaction, ""); } system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); @@ -594,7 +594,7 @@ TEST (node, confirm_locked) system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); system.wallet (0)->enter_password ("1"); auto block (std::make_shared (0, 0, 0, rai::keypair ().prv, 0, 0)); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); system.nodes[0]->network.republish_block (transaction, block); } @@ -629,7 +629,7 @@ TEST (node, fork_publish) auto existing (node1.active.roots.find (send1->root ())); ASSERT_NE (node1.active.roots.end (), existing); auto election (existing->election); - rai::transaction transaction (node1.store.environment, nullptr, false); + rai::transaction transaction (node1.store.environment, false); election->compute_rep_votes (transaction); node1.vote_processor.flush (); ASSERT_EQ (2, election->last_votes.size ()); @@ -674,8 +674,8 @@ TEST (node, fork_keep) ASSERT_NE (nullptr, votes1); ASSERT_EQ (1, votes1->last_votes.size ()); { - rai::transaction transaction0 (system.nodes[0]->store.environment, nullptr, false); - rai::transaction transaction1 (system.nodes[1]->store.environment, nullptr, false); + rai::transaction transaction0 (system.nodes[0]->store.environment, false); + rai::transaction transaction1 (system.nodes[1]->store.environment, false); ASSERT_TRUE (system.nodes[0]->store.block_exists (transaction0, send1->hash ())); ASSERT_TRUE (system.nodes[1]->store.block_exists (transaction1, send1->hash ())); } @@ -685,8 +685,8 @@ TEST (node, fork_keep) { ASSERT_NO_ERROR (system.poll ()); } - rai::transaction transaction0 (system.nodes[0]->store.environment, nullptr, false); - rai::transaction transaction1 (system.nodes[1]->store.environment, nullptr, false); + rai::transaction transaction0 (system.nodes[0]->store.environment, false); + rai::transaction transaction1 (system.nodes[1]->store.environment, false); // The vote should be in agreement with what we already have. auto winner (*votes1->tally (transaction0).begin ()); ASSERT_EQ (*send1, *winner.second); @@ -725,11 +725,11 @@ TEST (node, fork_flip) ASSERT_NE (nullptr, votes1); ASSERT_EQ (1, votes1->last_votes.size ()); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_TRUE (node1.store.block_exists (transaction, publish1.block->hash ())); } { - rai::transaction transaction (system.nodes[1]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[1]->store.environment, false); ASSERT_TRUE (node2.store.block_exists (transaction, publish2.block->hash ())); } system.deadline_set (10s); @@ -737,7 +737,7 @@ TEST (node, fork_flip) { ASSERT_NO_ERROR (system.poll ()); } - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); auto winner (*votes1->tally (transaction).begin ()); ASSERT_EQ (*publish1.block, *winner.second); ASSERT_EQ (rai::genesis_amount - 100, winner.first); @@ -780,11 +780,11 @@ TEST (node, fork_multi_flip) ASSERT_NE (nullptr, votes1); ASSERT_EQ (1, votes1->last_votes.size ()); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_TRUE (node1.store.block_exists (transaction, publish1.block->hash ())); } { - rai::transaction transaction (system.nodes[1]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[1]->store.environment, false); ASSERT_TRUE (node2.store.block_exists (transaction, publish2.block->hash ())); ASSERT_TRUE (node2.store.block_exists (transaction, publish3.block->hash ())); } @@ -793,7 +793,7 @@ TEST (node, fork_multi_flip) { ASSERT_NO_ERROR (system.poll ()); } - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); auto winner (*votes1->tally (transaction).begin ()); ASSERT_EQ (*publish1.block, *winner.second); ASSERT_EQ (rai::genesis_amount - 100, winner.first); @@ -823,7 +823,7 @@ TEST (node, fork_bootstrap_flip) node2.block_processor.add (send2, std::chrono::steady_clock::now ()); node2.block_processor.flush (); { - rai::transaction transaction (node2.store.environment, nullptr, false); + rai::transaction transaction (node2.store.environment, false); ASSERT_TRUE (node2.store.block_exists (transaction, send2->hash ())); } node1.network.send_keepalive (node2.network.endpoint ()); @@ -840,7 +840,7 @@ TEST (node, fork_bootstrap_flip) { ASSERT_NO_ERROR (system0.poll ()); ASSERT_NO_ERROR (system1.poll ()); - rai::transaction transaction (node2.store.environment, nullptr, false); + rai::transaction transaction (node2.store.environment, false); again = !node2.store.block_exists (transaction, send1->hash ()); } } @@ -912,7 +912,7 @@ TEST (node, fork_open_flip) { ASSERT_NO_ERROR (system.poll ()); } - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); auto winner (*votes1->tally (transaction).begin ()); ASSERT_EQ (*open1, *winner.second); ASSERT_EQ (rai::genesis_amount - 1, winner.first); @@ -926,7 +926,7 @@ TEST (node, coherent_observer) rai::system system (24000, 1); auto & node1 (*system.nodes[0]); node1.observers.blocks.add ([&node1](std::shared_ptr block_a, rai::account const &, rai::uint128_t const &, bool) { - rai::transaction transaction (node1.store.environment, nullptr, false); + rai::transaction transaction (node1.store.environment, false); ASSERT_TRUE (node1.store.block_exists (transaction, block_a->hash ())); }); system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); @@ -944,7 +944,7 @@ TEST (node, fork_no_vote_quorum) auto key4 (system.wallet (0)->deterministic_insert ()); system.wallet (0)->send_action (rai::test_genesis_key.pub, key4, rai::genesis_amount / 4); auto key1 (system.wallet (1)->deterministic_insert ()); - system.wallet (1)->store.representative_set (rai::transaction (system.wallet (1)->store.environment, nullptr, true), key1); + system.wallet (1)->store.representative_set (rai::transaction (system.wallet (1)->store.environment, true), key1); auto block (system.wallet (0)->send_action (rai::test_genesis_key.pub, key1, node1.config.receive_minimum.number ())); ASSERT_NE (nullptr, block); system.deadline_set (30s); @@ -962,7 +962,7 @@ TEST (node, fork_no_vote_quorum) auto key2 (system.wallet (2)->deterministic_insert ()); auto send2 (std::make_shared (block->hash (), key2, (rai::genesis_amount / 4) - (node1.config.receive_minimum.number () * 2), rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.work.generate (block->hash ()))); rai::raw_key key3; - ASSERT_FALSE (system.wallet (1)->store.fetch (rai::transaction (system.wallet (1)->store.environment, nullptr, false), key1, key3)); + ASSERT_FALSE (system.wallet (1)->store.fetch (rai::transaction (system.wallet (1)->store.environment, false), key1, key3)); auto vote (std::make_shared (key1, key3, 0, send2)); rai::confirm_ack confirm (vote); std::shared_ptr> bytes (new std::vector); @@ -992,13 +992,13 @@ TEST (node, DISABLED_fork_pre_confirm) rai::keypair key1; system.wallet (1)->insert_adhoc (key1.prv); { - rai::transaction transaction (system.wallet (1)->store.environment, nullptr, true); + rai::transaction transaction (system.wallet (1)->store.environment, true); system.wallet (1)->store.representative_set (transaction, key1.pub); } rai::keypair key2; system.wallet (2)->insert_adhoc (key2.prv); { - rai::transaction transaction (system.wallet (2)->store.environment, nullptr, true); + rai::transaction transaction (system.wallet (2)->store.environment, true); system.wallet (2)->store.representative_set (transaction, key2.pub); } system.deadline_set (30s); @@ -1061,9 +1061,9 @@ TEST (node, DISABLED_fork_stale) auto send2 (std::make_shared (rai::test_genesis_key.pub, send3->hash (), rai::test_genesis_key.pub, rai::genesis_amount - 2 * rai::Mxrb_ratio, key2.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); node1.work_generate_blocking (*send2); { - rai::transaction transaction1 (node1.store.environment, nullptr, true); + rai::transaction transaction1 (node1.store.environment, true); ASSERT_EQ (rai::process_result::progress, node1.ledger.process (transaction1, *send1).code); - rai::transaction transaction2 (node2.store.environment, nullptr, true); + rai::transaction transaction2 (node2.store.environment, true); ASSERT_EQ (rai::process_result::progress, node2.ledger.process (transaction2, *send2).code); } node1.process_active (send1); @@ -1091,9 +1091,9 @@ TEST (node, broadcast_elected) //std::cerr << "Small: " << rep_small.pub.to_account () << std::endl; //std::cerr << "Other: " << rep_other.pub.to_account () << std::endl; { - rai::transaction transaction0 (node0->store.environment, nullptr, true); - rai::transaction transaction1 (node1->store.environment, nullptr, true); - rai::transaction transaction2 (node2->store.environment, nullptr, true); + rai::transaction transaction0 (node0->store.environment, true); + rai::transaction transaction1 (node1->store.environment, true); + rai::transaction transaction2 (node2->store.environment, true); rai::send_block fund_big (node0->ledger.latest (transaction0, rai::test_genesis_key.pub), rep_big.pub, rai::Gxrb_ratio * 5, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); rai::open_block open_big (fund_big.hash (), rep_big.pub, rep_big.pub, rep_big.prv, rep_big.pub, 0); rai::send_block fund_small (fund_big.hash (), rep_small.pub, rai::Gxrb_ratio * 2, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -1156,7 +1156,7 @@ TEST (node, rep_self_vote) auto node0 (system.nodes[0]); rai::keypair rep_big; { - rai::transaction transaction0 (node0->store.environment, nullptr, true); + rai::transaction transaction0 (node0->store.environment, true); rai::send_block fund_big (node0->ledger.latest (transaction0, rai::test_genesis_key.pub), rep_big.pub, rai::uint128_t ("0xb0000000000000000000000000000000"), rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); rai::open_block open_big (fund_big.hash (), rep_big.pub, rep_big.pub, rep_big.prv, rep_big.pub, 0); node0->work_generate_blocking (fund_big); @@ -1173,7 +1173,7 @@ TEST (node, rep_self_vote) active.start (block0); auto existing (active.roots.find (block0->root ())); ASSERT_NE (active.roots.end (), existing); - rai::transaction transaction (node0->store.environment, nullptr, false); + rai::transaction transaction (node0->store.environment, false); existing->election->compute_rep_votes (transaction); node0->vote_processor.flush (); auto & rep_votes (existing->election->last_votes); @@ -1193,7 +1193,7 @@ TEST (node, DISABLED_bootstrap_no_publish) // node0 knows about send0 but node1 doesn't. rai::send_block send0 (system0.nodes[0]->latest (rai::test_genesis_key.pub), key0.pub, 500, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); { - rai::transaction transaction (node0->store.environment, nullptr, true); + rai::transaction transaction (node0->store.environment, true); ASSERT_EQ (rai::process_result::progress, system0.nodes[0]->ledger.process (transaction, send0).code); } ASSERT_FALSE (node1->bootstrap_initiator.in_progress ()); @@ -1223,7 +1223,7 @@ TEST (node, bootstrap_bulk_push) rai::send_block send0 (system0.nodes[0]->latest (rai::test_genesis_key.pub), key0.pub, 500, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); node0->work_generate_blocking (send0); { - rai::transaction transaction (node0->store.environment, nullptr, true); + rai::transaction transaction (node0->store.environment, true); ASSERT_EQ (rai::process_result::progress, system0.nodes[0]->ledger.process (transaction, send0).code); } ASSERT_FALSE (node0->bootstrap_initiator.in_progress ()); @@ -1255,8 +1255,8 @@ TEST (node, bootstrap_fork_open) node0->work_generate_blocking (open0); node0->work_generate_blocking (open1); { - rai::transaction transaction0 (node0->store.environment, nullptr, true); - rai::transaction transaction1 (node1->store.environment, nullptr, true); + rai::transaction transaction0 (node0->store.environment, true); + rai::transaction transaction1 (node1->store.environment, true); // Both know about send0 ASSERT_EQ (rai::process_result::progress, node0->ledger.process (transaction0, send0).code); ASSERT_EQ (rai::process_result::progress, node1->ledger.process (transaction1, send0).code); @@ -1295,7 +1295,7 @@ TEST (node, DISABLED_unconfirmed_send) auto latest (node1.latest (key0.pub)); rai::state_block send2 (key0.pub, latest, rai::genesis_account, rai::Mxrb_ratio, rai::genesis_account, key0.prv, key0.pub, node0.work_generate_blocking (latest)); { - rai::transaction transaction (node1.store.environment, nullptr, true); + rai::transaction transaction (node1.store.environment, true); ASSERT_EQ (rai::process_result::progress, node1.ledger.process (transaction, send2).code); } auto send3 (wallet1->send_action (key0.pub, rai::genesis_account, rai::Mxrb_ratio)); @@ -1409,11 +1409,11 @@ TEST (node, vote_replay) system.nodes[0]->work_generate_blocking (*open); for (auto i (0); i < 11000; ++i) { - rai::transaction transaction (system.nodes[1]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[1]->store.environment, false); auto vote (system.nodes[1]->store.vote_generate (transaction, rai::test_genesis_key.pub, rai::test_genesis_key.prv, open)); } { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); std::lock_guard lock (system.nodes[0]->store.cache_mutex); auto vote (system.nodes[0]->store.vote_current (transaction, rai::test_genesis_key.pub)); ASSERT_EQ (nullptr, vote); @@ -1426,7 +1426,7 @@ TEST (node, vote_replay) while (!done) { auto ec = system.poll (); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); std::lock_guard lock (system.nodes[0]->store.cache_mutex); auto vote (system.nodes[0]->store.vote_current (transaction, rai::test_genesis_key.pub)); done = vote && (vote->sequence >= 10000); @@ -1521,7 +1521,7 @@ TEST (node, block_confirm) system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); auto send1 (std::make_shared (rai::test_genesis_key.pub, genesis.hash (), rai::test_genesis_key.pub, rai::genesis_amount - rai::Gxrb_ratio, rai::test_genesis_key.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.nodes[0]->work_generate_blocking (genesis.hash ()))); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (transaction, *send1).code); } system.nodes[0]->block_confirm (send1); @@ -1588,7 +1588,7 @@ TEST (node, confirm_quorum) // Put greater than online_weight_minimum in pending so quorum can't be reached auto send1 (std::make_shared (rai::test_genesis_key.pub, genesis.hash (), rai::test_genesis_key.pub, rai::Gxrb_ratio, rai::test_genesis_key.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.nodes[0]->work_generate_blocking (genesis.hash ()))); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (transaction, *send1).code); } system.wallet (0)->send_action (rai::test_genesis_key.pub, rai::test_genesis_key.pub, rai::Gxrb_ratio); diff --git a/rai/core_test/processor_service.cpp b/rai/core_test/processor_service.cpp index a42457e1..20c55909 100644 --- a/rai/core_test/processor_service.cpp +++ b/rai/core_test/processor_service.cpp @@ -14,7 +14,7 @@ TEST (processor_service, bad_send_signature) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::account_info info1; ASSERT_FALSE (store.account_get (transaction, rai::test_genesis_key.pub, info1)); @@ -33,7 +33,7 @@ TEST (processor_service, bad_receive_signature) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::account_info info1; ASSERT_FALSE (store.account_get (transaction, rai::test_genesis_key.pub, info1)); diff --git a/rai/core_test/rpc.cpp b/rai/core_test/rpc.cpp index 8fff07c0..f471d88e 100644 --- a/rai/core_test/rpc.cpp +++ b/rai/core_test/rpc.cpp @@ -541,7 +541,7 @@ TEST (rpc, wallet_representative_set) system.poll (); } ASSERT_EQ (200, response.status); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_EQ (key.pub, system.nodes[0]->wallets.items.begin ()->second->store.representative (transaction)); } @@ -637,7 +637,7 @@ TEST (rpc, wallet_export) ASSERT_EQ (200, response.status); std::string wallet_json (response.json.get ("json")); bool error (false); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); rai::kdf kdf; rai::wallet_store store (error, kdf, transaction, rai::genesis_account, 1, "0", wallet_json); ASSERT_FALSE (error); @@ -693,7 +693,7 @@ TEST (rpc, account_move) ASSERT_EQ ("1", response.json.get ("moved")); ASSERT_TRUE (destination->exists (key.pub)); ASSERT_TRUE (destination->exists (rai::test_genesis_key.pub)); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_EQ (source->store.end (), source->store.begin (transaction)); } @@ -803,7 +803,7 @@ TEST (rpc, frontier) rai::system system (24000, 1); std::unordered_map source; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); for (auto i (0); i < 1000; ++i) { rai::keypair key; @@ -843,7 +843,7 @@ TEST (rpc, frontier_limited) rai::system system (24000, 1); std::unordered_map source; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); for (auto i (0); i < 1000; ++i) { rai::keypair key; @@ -873,7 +873,7 @@ TEST (rpc, frontier_startpoint) rai::system system (24000, 1); std::unordered_map source; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); for (auto i (0); i < 1000; ++i) { rai::keypair key; @@ -915,7 +915,7 @@ TEST (rpc, history) rai::state_block ureceive (rai::genesis_account, usend.hash (), rai::genesis_account, rai::genesis_amount, usend.hash (), rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); rai::state_block uchange (rai::genesis_account, ureceive.hash (), rai::keypair ().pub, rai::genesis_amount, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); { - rai::transaction transaction (node0->store.environment, nullptr, true); + rai::transaction transaction (node0->store.environment, true); ASSERT_EQ (rai::process_result::progress, node0->ledger.process (transaction, usend).code); ASSERT_EQ (rai::process_result::progress, node0->ledger.process (transaction, ureceive).code); ASSERT_EQ (rai::process_result::progress, node0->ledger.process (transaction, uchange).code); @@ -1144,7 +1144,7 @@ TEST (rpc, payment_begin_end) rai::uint256_union account; ASSERT_FALSE (account.decode_account (account_text)); ASSERT_TRUE (wallet->exists (account)); - auto root1 (system.nodes[0]->ledger.latest_root (rai::transaction (wallet->store.environment, nullptr, false), account)); + auto root1 (system.nodes[0]->ledger.latest_root (rai::transaction (wallet->store.environment, false), account)); uint64_t work (0); while (!rai::work_validate (root1, work)) { @@ -1155,7 +1155,7 @@ TEST (rpc, payment_begin_end) while (rai::work_validate (root1, work)) { auto ec = system.poll (); - ASSERT_FALSE (wallet->store.work_get (rai::transaction (wallet->store.environment, nullptr, false), account, work)); + ASSERT_FALSE (wallet->store.work_get (rai::transaction (wallet->store.environment, false), account, work)); ASSERT_NO_ERROR (ec); } ASSERT_EQ (wallet->free_accounts.end (), wallet->free_accounts.find (account)); @@ -1181,7 +1181,7 @@ TEST (rpc, payment_end_nonempty) rai::node_init init1; auto node1 (system.nodes[0]); system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); - system.wallet (0)->init_free_accounts (rai::transaction (node1->store.environment, nullptr, false)); + system.wallet (0)->init_free_accounts (rai::transaction (node1->store.environment, false)); auto wallet_id (node1->wallets.items.begin ()->first); rai::rpc rpc (system.service, *system.nodes[0], rai::rpc_config (true)); rpc.start (); @@ -1204,7 +1204,7 @@ TEST (rpc, payment_zero_balance) rai::node_init init1; auto node1 (system.nodes[0]); system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); - system.wallet (0)->init_free_accounts (rai::transaction (node1->store.environment, nullptr, false)); + system.wallet (0)->init_free_accounts (rai::transaction (node1->store.environment, false)); auto wallet_id (node1->wallets.items.begin ()->first); rai::rpc rpc (system.service, *system.nodes[0], rai::rpc_config (true)); rpc.start (); @@ -1279,7 +1279,7 @@ TEST (rpc, payment_begin_locked) rai::keypair wallet_id; auto wallet (node1->wallets.create (wallet_id.pub)); { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); wallet->store.rekey (transaction, "1"); ASSERT_TRUE (wallet->store.attempt_password (transaction, "")); } @@ -1469,7 +1469,7 @@ TEST (rpc, search_pending) system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); auto wallet (system.nodes[0]->wallets.items.begin ()->first.to_string ()); rai::send_block block (system.nodes[0]->latest (rai::test_genesis_key.pub), rai::test_genesis_key.pub, rai::genesis_amount - system.nodes[0]->config.receive_minimum.number (), rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); - ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (rai::transaction (system.nodes[0]->store.environment, nullptr, true), block).code); + ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (rai::transaction (system.nodes[0]->store.environment, true), block).code); rai::rpc rpc (system.service, *system.nodes[0], rai::rpc_config (true)); rpc.start (); boost::property_tree::ptree request; @@ -1509,7 +1509,7 @@ TEST (rpc, version) ASSERT_EQ ("1", response1.json.get ("rpc_version")); ASSERT_EQ (200, response1.status); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_EQ (std::to_string (node1->store.version_get (transaction)), response1.json.get ("store_version")); } ASSERT_EQ (boost::str (boost::format ("RaiBlocks %1%.%2%") % RAIBLOCKS_VERSION_MAJOR % RAIBLOCKS_VERSION_MINOR), response1.json.get ("node_vendor")); @@ -1914,7 +1914,7 @@ TEST (rpc, account_representative_set) rai::block_hash hash; ASSERT_FALSE (hash.decode_hex (block_text1)); ASSERT_FALSE (hash.is_zero ()); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_TRUE (system.nodes[0]->store.block_exists (transaction, hash)); ASSERT_EQ (rep.pub, system.nodes[0]->store.block_get (transaction, hash)->representative ()); } @@ -1926,7 +1926,7 @@ TEST (rpc, bootstrap) auto latest (system1.nodes[0]->latest (rai::test_genesis_key.pub)); rai::send_block send (latest, rai::genesis_account, 100, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system1.nodes[0]->work_generate_blocking (latest)); { - rai::transaction transaction (system1.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system1.nodes[0]->store.environment, true); ASSERT_EQ (rai::process_result::progress, system1.nodes[0]->ledger.process (transaction, send).code); } rai::rpc rpc (system0.service, *system0.nodes[0], rai::rpc_config (true)); @@ -1997,7 +1997,7 @@ TEST (rpc, wallet_change_seed) rai::system system0 (24000, 1); rai::keypair seed; { - rai::transaction transaction (system0.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system0.nodes[0]->store.environment, false); rai::raw_key seed0; system0.wallet (0)->store.seed (seed0, transaction); ASSERT_NE (seed.pub, seed0.data); @@ -2015,7 +2015,7 @@ TEST (rpc, wallet_change_seed) } ASSERT_EQ (200, response.status); { - rai::transaction transaction (system0.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system0.nodes[0]->store.environment, false); rai::raw_key seed0; system0.wallet (0)->store.seed (seed0, transaction); ASSERT_EQ (seed.pub, seed0.data); @@ -2122,7 +2122,7 @@ TEST (rpc, bootstrap_any) auto latest (system1.nodes[0]->latest (rai::test_genesis_key.pub)); rai::send_block send (latest, rai::genesis_account, 100, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system1.nodes[0]->work_generate_blocking (latest)); { - rai::transaction transaction (system1.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system1.nodes[0]->store.environment, true); ASSERT_EQ (rai::process_result::progress, system1.nodes[0]->ledger.process (transaction, send).code); } rai::rpc rpc (system0.service, *system0.nodes[0], rai::rpc_config (true)); @@ -2216,7 +2216,7 @@ TEST (rpc, deterministic_key) rai::system system0 (24000, 1); rai::raw_key seed; { - rai::transaction transaction (system0.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system0.nodes[0]->store.environment, false); system0.wallet (0)->store.seed (seed, transaction); } rai::account account0 (system0.wallet (0)->deterministic_insert ()); @@ -2426,7 +2426,7 @@ TEST (rpc, wallet_info) auto send (system.wallet (0)->send_action (rai::test_genesis_key.pub, key.pub, 1)); rai::account account (system.wallet (0)->deterministic_insert ()); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); system.wallet (0)->store.erase (transaction, account); } account = system.wallet (0)->deterministic_insert (); @@ -2686,7 +2686,7 @@ TEST (rpc, work_get) ASSERT_EQ (200, response.status); std::string work_text (response.json.get ("work")); uint64_t work (1); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); system.nodes[0]->wallets.items.begin ()->second->store.work_get (transaction, rai::genesis_account, work); ASSERT_EQ (rai::to_string_hex (work), work_text); } @@ -2707,7 +2707,7 @@ TEST (rpc, wallet_work_get) system.poll (); } ASSERT_EQ (200, response.status); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); for (auto & works : response.json.get_child ("works")) { std::string account_text (works.first); @@ -2740,7 +2740,7 @@ TEST (rpc, work_set) std::string success (response.json.get ("success")); ASSERT_TRUE (success.empty ()); uint64_t work1 (1); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); system.nodes[0]->wallets.items.begin ()->second->store.work_get (transaction, rai::genesis_account, work1); ASSERT_EQ (work1, work0); } @@ -2750,7 +2750,7 @@ TEST (rpc, search_pending_all) rai::system system (24000, 1); system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); rai::send_block block (system.nodes[0]->latest (rai::test_genesis_key.pub), rai::test_genesis_key.pub, rai::genesis_amount - system.nodes[0]->config.receive_minimum.number (), rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); - ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (rai::transaction (system.nodes[0]->store.environment, nullptr, true), block).code); + ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (rai::transaction (system.nodes[0]->store.environment, true), block).code); rai::rpc rpc (system.service, *system.nodes[0], rai::rpc_config (true)); rpc.start (); boost::property_tree::ptree request; @@ -3657,7 +3657,7 @@ TEST (rpc, block_confirm) system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); auto send1 (std::make_shared (rai::test_genesis_key.pub, genesis.hash (), rai::test_genesis_key.pub, rai::genesis_amount - rai::Gxrb_ratio, rai::test_genesis_key.pub, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system.nodes[0]->work_generate_blocking (genesis.hash ()))); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (transaction, *send1).code); } rai::rpc rpc (system.service, *system.nodes[0], rai::rpc_config (true)); diff --git a/rai/core_test/versioning.cpp b/rai/core_test/versioning.cpp index 75ccb5fb..d000e172 100644 --- a/rai/core_test/versioning.cpp +++ b/rai/core_test/versioning.cpp @@ -13,7 +13,7 @@ TEST (versioning, account_info_v1) auto error (false); rai::block_store store (error, file); ASSERT_FALSE (error); - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.block_put (transaction, open.hash (), open); auto status (mdb_put (transaction, store.accounts_v0, rai::mdb_val (account), v1.val (), 0)); ASSERT_EQ (0, status); @@ -23,7 +23,7 @@ TEST (versioning, account_info_v1) auto error (false); rai::block_store store (error, file); ASSERT_FALSE (error); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); rai::account_info v2; ASSERT_FALSE (store.account_get (transaction, account, v2)); ASSERT_EQ (open.hash (), v2.open_block); diff --git a/rai/core_test/wallet.cpp b/rai/core_test/wallet.cpp index b30fcc0b..42bfc7b8 100644 --- a/rai/core_test/wallet.cpp +++ b/rai/core_test/wallet.cpp @@ -11,7 +11,7 @@ TEST (wallet, no_key) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (init); @@ -26,7 +26,7 @@ TEST (wallet, fetch_locked) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_TRUE (wallet.valid_password (transaction)); @@ -48,7 +48,7 @@ TEST (wallet, retrieval) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (init); @@ -70,7 +70,7 @@ TEST (wallet, empty_iteration) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (init); @@ -84,7 +84,7 @@ TEST (wallet, one_item_iteration) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (init); @@ -113,7 +113,7 @@ TEST (wallet, two_item_iteration) std::unordered_set prvs; rai::kdf kdf; { - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (init); wallet.insert_adhoc (transaction, key1.prv); @@ -155,7 +155,7 @@ TEST (wallet, spend_all_one) ASSERT_NE (nullptr, system.wallet (0)->send_action (rai::test_genesis_key.pub, key2.pub, std::numeric_limits::max ())); rai::account_info info2; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); system.nodes[0]->store.account_get (transaction, rai::test_genesis_key.pub, info2); ASSERT_NE (latest1, info2.head); auto block (system.nodes[0]->store.block_get (transaction, info2.head)); @@ -195,7 +195,7 @@ TEST (wallet, spend) ASSERT_NE (nullptr, system.wallet (0)->send_action (rai::test_genesis_key.pub, key2.pub, std::numeric_limits::max ())); rai::account_info info2; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); system.nodes[0]->store.account_get (transaction, rai::test_genesis_key.pub, info2); ASSERT_NE (latest1, info2.head); auto block (system.nodes[0]->store.block_get (transaction, info2.head)); @@ -233,7 +233,7 @@ TEST (wallet, spend_no_previous) rai::system system (24000, 1); { system.wallet (0)->insert_adhoc (rai::test_genesis_key.prv); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); rai::account_info info1; ASSERT_FALSE (system.nodes[0]->store.account_get (transaction, rai::test_genesis_key.pub, info1)); for (auto i (0); i < 50; ++i) @@ -252,7 +252,7 @@ TEST (wallet, find_none) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (init); @@ -265,7 +265,7 @@ TEST (wallet, find_existing) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (init); @@ -284,7 +284,7 @@ TEST (wallet, rekey) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (init); @@ -347,7 +347,7 @@ TEST (wallet, hash_password) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (init); @@ -395,7 +395,7 @@ TEST (wallet, reopen_default_password) { bool init; rai::mdb_env environment (init, rai::unique_path ()); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); ASSERT_FALSE (init); rai::kdf kdf; { @@ -432,7 +432,7 @@ TEST (wallet, representative) auto error (false); rai::mdb_env environment (error, rai::unique_path ()); ASSERT_FALSE (error); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (error, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (error); @@ -453,7 +453,7 @@ TEST (wallet, serialize_json_empty) auto error (false); rai::mdb_env environment (error, rai::unique_path ()); ASSERT_FALSE (error); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet1 (error, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (error); @@ -478,7 +478,7 @@ TEST (wallet, serialize_json_one) auto error (false); rai::mdb_env environment (error, rai::unique_path ()); ASSERT_FALSE (error); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet1 (error, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (error); @@ -507,7 +507,7 @@ TEST (wallet, serialize_json_password) auto error (false); rai::mdb_env environment (error, rai::unique_path ()); ASSERT_FALSE (error); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet1 (error, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (error); @@ -540,7 +540,7 @@ TEST (wallet_store, move) auto error (false); rai::mdb_env environment (error, rai::unique_path ()); ASSERT_FALSE (error); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet1 (error, kdf, transaction, rai::genesis_account, 1, "0"); ASSERT_FALSE (error); @@ -608,7 +608,7 @@ TEST (wallet, work) system.deadline_set (10s); while (!done) { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); uint64_t work (0); if (!wallet->store.work_get (transaction, rai::test_genesis_key.pub, work)) { @@ -627,13 +627,13 @@ TEST (wallet, work_generate) wallet->insert_adhoc (rai::test_genesis_key.prv); rai::account account1; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); account1 = system.account (transaction, 0); } rai::keypair key; wallet->send_action (rai::test_genesis_key.pub, key.pub, 100); system.deadline_set (10s); - while (system.nodes[0]->ledger.account_balance (rai::transaction (system.nodes[0]->store.environment, nullptr, false), rai::test_genesis_key.pub) == amount1) + while (system.nodes[0]->ledger.account_balance (rai::transaction (system.nodes[0]->store.environment, false), rai::test_genesis_key.pub) == amount1) { ASSERT_NO_ERROR (system.poll ()); } @@ -642,7 +642,7 @@ TEST (wallet, work_generate) while (again) { ASSERT_NO_ERROR (system.poll ()); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); again = wallet->store.work_get (transaction, account1, work1) || rai::work_validate (system.nodes[0]->ledger.latest_root (transaction, account1), work1); } } @@ -651,7 +651,7 @@ TEST (wallet, insert_locked) { rai::system system (24000, 1); auto wallet (system.wallet (0)); - wallet->store.rekey (rai::transaction (wallet->store.environment, nullptr, true), "1"); + wallet->store.rekey (rai::transaction (wallet->store.environment, true), "1"); ASSERT_TRUE (wallet->valid_password ()); wallet->enter_password (""); ASSERT_FALSE (wallet->valid_password ()); @@ -665,11 +665,11 @@ TEST (wallet, version_1_upgrade) wallet->enter_initial_password (); ASSERT_TRUE (wallet->valid_password ()); rai::keypair key; - wallet->store.rekey (rai::transaction (wallet->store.environment, nullptr, true), "1"); + wallet->store.rekey (rai::transaction (wallet->store.environment, true), "1"); wallet->enter_password (""); ASSERT_FALSE (wallet->valid_password ()); { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); rai::raw_key password_l; rai::wallet_value value (wallet->store.entry_get_raw (transaction, rai::wallet_store::wallet_key_special)); rai::raw_key kdf; @@ -683,13 +683,13 @@ TEST (wallet, version_1_upgrade) wallet->enter_password ("1"); ASSERT_TRUE (wallet->valid_password ()); - ASSERT_EQ (wallet->store.version_current, wallet->store.version (rai::transaction (wallet->store.environment, nullptr, false))); + ASSERT_EQ (wallet->store.version_current, wallet->store.version (rai::transaction (wallet->store.environment, false))); rai::raw_key prv; - ASSERT_FALSE (wallet->store.fetch (rai::transaction (wallet->store.environment, nullptr, false), key.pub, prv)); + ASSERT_FALSE (wallet->store.fetch (rai::transaction (wallet->store.environment, false), key.pub, prv)); ASSERT_EQ (key.prv, prv); { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); rai::raw_key password_l; rai::wallet_value value (wallet->store.entry_get_raw (transaction, rai::wallet_store::wallet_key_special)); rai::raw_key kdf; @@ -702,9 +702,9 @@ TEST (wallet, version_1_upgrade) } wallet->enter_password ("1"); ASSERT_TRUE (wallet->valid_password ()); - ASSERT_EQ (wallet->store.version_current, wallet->store.version (rai::transaction (wallet->store.environment, nullptr, false))); + ASSERT_EQ (wallet->store.version_current, wallet->store.version (rai::transaction (wallet->store.environment, false))); rai::raw_key prv2; - ASSERT_FALSE (wallet->store.fetch (rai::transaction (wallet->store.environment, nullptr, false), key.pub, prv2)); + ASSERT_FALSE (wallet->store.fetch (rai::transaction (wallet->store.environment, false), key.pub, prv2)); ASSERT_EQ (key.prv, prv2); } @@ -713,7 +713,7 @@ TEST (wallet, deterministic_keys) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); rai::raw_key key1; @@ -759,7 +759,7 @@ TEST (wallet, reseed) bool init; rai::mdb_env environment (init, rai::unique_path ()); ASSERT_FALSE (init); - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); rai::kdf kdf; rai::wallet_store wallet (init, kdf, transaction, rai::genesis_account, 1, "0"); rai::raw_key seed1; @@ -791,7 +791,7 @@ TEST (wallet, insert_deterministic_locked) { rai::system system (24000, 1); auto wallet (system.wallet (0)); - wallet->store.rekey (rai::transaction (wallet->store.environment, nullptr, true), "1"); + wallet->store.rekey (rai::transaction (wallet->store.environment, true), "1"); ASSERT_TRUE (wallet->valid_password ()); wallet->enter_password (""); ASSERT_FALSE (wallet->valid_password ()); @@ -803,7 +803,7 @@ TEST (wallet, version_2_upgrade) rai::system system (24000, 1); auto wallet (system.wallet (0)); { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); wallet->store.rekey (transaction, "1"); ASSERT_TRUE (wallet->store.attempt_password (transaction, "")); wallet->store.erase (transaction, rai::wallet_store::deterministic_index_special); @@ -811,13 +811,13 @@ TEST (wallet, version_2_upgrade) wallet->store.version_put (transaction, 2); } { - rai::transaction transaction (wallet->store.environment, nullptr, false); + rai::transaction transaction (wallet->store.environment, false); ASSERT_EQ (2, wallet->store.version (transaction)); ASSERT_FALSE (wallet->store.exists (transaction, rai::wallet_store::deterministic_index_special)); ASSERT_FALSE (wallet->store.exists (transaction, rai::wallet_store::seed_special)); wallet->store.attempt_password (transaction, "1"); } - rai::transaction transaction (wallet->store.environment, nullptr, false); + rai::transaction transaction (wallet->store.environment, false); ASSERT_EQ (wallet->store.version_current, wallet->store.version (transaction)); ASSERT_TRUE (wallet->store.exists (transaction, rai::wallet_store::deterministic_index_special)); ASSERT_TRUE (wallet->store.exists (transaction, rai::wallet_store::seed_special)); @@ -828,16 +828,16 @@ TEST (wallet, version_3_upgrade) { rai::system system (24000, 1); auto wallet (system.wallet (0)); - wallet->store.rekey (rai::transaction (wallet->store.environment, nullptr, true), "1"); + wallet->store.rekey (rai::transaction (wallet->store.environment, true), "1"); wallet->enter_password ("1"); ASSERT_TRUE (wallet->valid_password ()); - ASSERT_EQ (wallet->store.version_current, wallet->store.version (rai::transaction (wallet->store.environment, nullptr, false))); + ASSERT_EQ (wallet->store.version_current, wallet->store.version (rai::transaction (wallet->store.environment, false))); rai::keypair key; rai::raw_key seed; rai::uint256_union seed_ciphertext; rai::random_pool.GenerateBlock (seed.data.bytes.data (), seed.data.bytes.size ()); { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); rai::raw_key password_l; rai::wallet_value value (wallet->store.entry_get_raw (transaction, rai::wallet_store::wallet_key_special)); rai::raw_key kdf; @@ -852,12 +852,12 @@ TEST (wallet, version_3_upgrade) } wallet->enter_password ("1"); ASSERT_TRUE (wallet->valid_password ()); - ASSERT_EQ (wallet->store.version_current, wallet->store.version (rai::transaction (wallet->store.environment, nullptr, false))); + ASSERT_EQ (wallet->store.version_current, wallet->store.version (rai::transaction (wallet->store.environment, false))); rai::raw_key prv; - ASSERT_FALSE (wallet->store.fetch (rai::transaction (wallet->store.environment, nullptr, false), key.pub, prv)); + ASSERT_FALSE (wallet->store.fetch (rai::transaction (wallet->store.environment, false), key.pub, prv)); ASSERT_EQ (key.prv, prv); { - rai::transaction transaction (wallet->store.environment, nullptr, false); + rai::transaction transaction (wallet->store.environment, false); rai::raw_key seed_compare; wallet->store.seed (seed_compare, transaction); ASSERT_EQ (seed, seed_compare); @@ -874,7 +874,7 @@ TEST (wallet, no_work) ASSERT_NE (nullptr, block); ASSERT_NE (0, block->block_work ()); ASSERT_FALSE (rai::work_validate (block->root (), block->block_work ())); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); uint64_t cached_work (0); system.wallet (0)->store.work_get (transaction, rai::test_genesis_key.pub, cached_work); ASSERT_EQ (0, cached_work); @@ -900,13 +900,13 @@ TEST (wallet, password_race) system.nodes[0]->background ([&wallet]() { for (int i = 0; i < 100; i++) { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); wallet->store.rekey (transaction, std::to_string (i)); } }); for (int i = 0; i < 100; i++) { - rai::transaction transaction (wallet->store.environment, nullptr, false); + rai::transaction transaction (wallet->store.environment, false); // Password should always be valid, the rekey operation should be atomic. bool ok = wallet->store.valid_password (transaction); EXPECT_TRUE (ok); @@ -926,12 +926,12 @@ TEST (wallet, password_race_corrupt_seed) auto wallet = system.wallet (0); rai::raw_key seed; { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); ASSERT_FALSE (wallet->store.rekey (transaction, "4567")); wallet->store.seed (seed, transaction); } { - rai::transaction transaction (wallet->store.environment, nullptr, false); + rai::transaction transaction (wallet->store.environment, false); ASSERT_FALSE (wallet->store.attempt_password (transaction, "4567")); } for (int i = 0; i < 100; i++) @@ -939,21 +939,21 @@ TEST (wallet, password_race_corrupt_seed) system.nodes[0]->background ([&wallet]() { for (int i = 0; i < 10; i++) { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); wallet->store.rekey (transaction, "0000"); } }); system.nodes[0]->background ([&wallet]() { for (int i = 0; i < 10; i++) { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); wallet->store.rekey (transaction, "1234"); } }); system.nodes[0]->background ([&wallet]() { for (int i = 0; i < 10; i++) { - rai::transaction transaction (wallet->store.environment, nullptr, false); + rai::transaction transaction (wallet->store.environment, false); wallet->store.attempt_password (transaction, "1234"); } }); @@ -961,7 +961,7 @@ TEST (wallet, password_race_corrupt_seed) system.stop (); runner.join (); { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); if (!wallet->store.attempt_password (transaction, "1234")) { rai::raw_key seed_now; diff --git a/rai/core_test/wallets.cpp b/rai/core_test/wallets.cpp index 1c36134e..f597ae7e 100644 --- a/rai/core_test/wallets.cpp +++ b/rai/core_test/wallets.cpp @@ -87,7 +87,7 @@ TEST (wallets, DISABLED_wallet_create_max) ASSERT_TRUE (existing != wallets.items.end ()); rai::raw_key seed; seed.data = 0; - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); existing->second->store.seed_set (transaction, seed); } rai::keypair key; diff --git a/rai/node/bootstrap.cpp b/rai/node/bootstrap.cpp index e261907e..640cea89 100644 --- a/rai/node/bootstrap.cpp +++ b/rai/node/bootstrap.cpp @@ -210,7 +210,7 @@ current (0), count (0), bulk_push_cost (0) { - rai::transaction transaction (connection->node->store.environment, nullptr, false); + rai::transaction transaction (connection->node->store.environment, false); next (transaction); } @@ -286,7 +286,7 @@ void rai::frontier_req_client::received_frontier (boost::system::error_code cons { BOOST_LOG (connection->node->log) << boost::str (boost::format ("Received %1% frontiers from %2%") % std::to_string (count) % connection->socket->remote_endpoint ()); } - rai::transaction transaction (connection->node->store.environment, nullptr, false); + rai::transaction transaction (connection->node->store.environment, false); if (!account.is_zero ()) { while (!current.is_zero () && current < account) @@ -587,7 +587,7 @@ void rai::bulk_push_client::start () } auto this_l (shared_from_this ()); connection->socket->async_write (buffer, [this_l, buffer](boost::system::error_code const & ec, size_t size_a) { - rai::transaction transaction (this_l->connection->node->store.environment, nullptr, false); + rai::transaction transaction (this_l->connection->node->store.environment, false); if (!ec) { this_l->push (transaction); @@ -680,7 +680,7 @@ void rai::bulk_push_client::push_block (rai::block const & block_a) connection->socket->async_write (buffer, [this_l, buffer](boost::system::error_code const & ec, size_t size_a) { if (!ec) { - rai::transaction transaction (this_l->connection->node->store.environment, nullptr, false); + rai::transaction transaction (this_l->connection->node->store.environment, false); this_l->push (transaction); } else @@ -1592,7 +1592,7 @@ void rai::bulk_pull_server::set_current_end () { include_start = false; assert (request != nullptr); - rai::transaction transaction (connection->node->store.environment, nullptr, false); + rai::transaction transaction (connection->node->store.environment, false); if (!connection->node->store.block_exists (transaction, request->end)) { if (connection->node->config.logging.bulk_pull_logging ()) @@ -1699,7 +1699,7 @@ std::unique_ptr rai::bulk_pull_server::get_next () if (send_current) { - rai::transaction transaction (connection->node->store.environment, nullptr, false); + rai::transaction transaction (connection->node->store.environment, false); result = connection->node->store.block_get (transaction, current); if (result != nullptr && set_current_to_end == false) { @@ -1839,7 +1839,7 @@ void rai::bulk_pull_account_server::send_frontier () /** ** Establish a database transaction **/ - rai::transaction stream_transaction (connection->node->store.environment, nullptr, false); + rai::transaction stream_transaction (connection->node->store.environment, false); /** ** Get account balance and frontier block hash @@ -1939,7 +1939,7 @@ std::pair, std::unique_ptr> * destroy a database transaction, to avoid locking the * database for a prolonged period. */ - rai::transaction stream_transaction (connection->node->store.environment, nullptr, false); + rai::transaction stream_transaction (connection->node->store.environment, false); auto stream (connection->node->store.pending_begin (stream_transaction, current_key)); if (stream == rai::store_iterator (nullptr)) @@ -2207,7 +2207,7 @@ std::unique_ptr rai::bulk_pull_blocks_server::get_next () auto current = rai::uint256_union (stream->first); if (current < request->max_hash) { - rai::transaction transaction (connection->node->store.environment, nullptr, false); + rai::transaction transaction (connection->node->store.environment, false); result = connection->node->store.block_get (transaction, current); ++stream; @@ -2267,7 +2267,7 @@ connection (connection_a), request (std::move (request_a)), send_buffer (std::make_shared> ()), stream (nullptr), -stream_transaction (connection_a->node->store.environment, nullptr, false), +stream_transaction (connection_a->node->store.environment, false), sent_count (0), checksum (0) { @@ -2482,7 +2482,7 @@ void rai::frontier_req_server::sent_action (boost::system::error_code const & ec void rai::frontier_req_server::next () { - rai::transaction transaction (connection->node->store.environment, nullptr, false); + rai::transaction transaction (connection->node->store.environment, false); auto iterator (connection->node->store.latest_begin (transaction, current.number () + 1)); if (iterator != connection->node->store.latest_end ()) { diff --git a/rai/node/cli.cpp b/rai/node/cli.cpp index b18e3862..a6c4d345 100644 --- a/rai/node/cli.cpp +++ b/rai/node/cli.cpp @@ -77,7 +77,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map { if (!wallet->enter_password (password)) { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); auto pub (wallet->store.deterministic_insert (transaction)); std::cout << boost::str (boost::format ("Account: %1%\n") % pub.to_account ()); } @@ -151,12 +151,12 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map inactive_node node (data_path); if (vm.count ("unchecked_clear")) { - rai::transaction transaction (node.node->store.environment, nullptr, true); + rai::transaction transaction (node.node->store.environment, true); node.node->store.unchecked_clear (transaction); } if (vm.count ("delete_node_id")) { - rai::transaction transaction (node.node->store.environment, nullptr, true); + rai::transaction transaction (node.node->store.environment, true); node.node->store.delete_node_id (transaction); } success = node.node->copy_with_compaction (vacuum_path); @@ -198,12 +198,12 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map inactive_node node (data_path); if (vm.count ("unchecked_clear")) { - rai::transaction transaction (node.node->store.environment, nullptr, true); + rai::transaction transaction (node.node->store.environment, true); node.node->store.unchecked_clear (transaction); } if (vm.count ("delete_node_id")) { - rai::transaction transaction (node.node->store.environment, nullptr, true); + rai::transaction transaction (node.node->store.environment, true); node.node->store.delete_node_id (transaction); } success = node.node->copy_with_compaction (snapshot_path); @@ -226,7 +226,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map { boost::filesystem::path data_path = vm.count ("data_path") ? boost::filesystem::path (vm["data_path"].as ()) : rai::working_path (); inactive_node node (data_path); - rai::transaction transaction (node.node->store.environment, nullptr, true); + rai::transaction transaction (node.node->store.environment, true); node.node->store.unchecked_clear (transaction); std::cerr << "Unchecked blocks deleted" << std::endl; } @@ -234,7 +234,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map { boost::filesystem::path data_path = vm.count ("data_path") ? boost::filesystem::path (vm["data_path"].as ()) : rai::working_path (); inactive_node node (data_path); - rai::transaction transaction (node.node->store.environment, nullptr, true); + rai::transaction transaction (node.node->store.environment, true); node.node->store.delete_node_id (transaction); std::cerr << "Deleted Node ID" << std::endl; } @@ -311,7 +311,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map rai::raw_key key; if (!key.data.decode_hex (vm["key"].as ())) { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); wallet->store.insert_adhoc (transaction, key); } else @@ -365,7 +365,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map rai::raw_key key; if (!key.data.decode_hex (vm["key"].as ())) { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); wallet->change_seed (transaction, key); } else @@ -423,7 +423,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map { if (!existing->second->enter_password (password)) { - rai::transaction transaction (existing->second->store.environment, nullptr, false); + rai::transaction transaction (existing->second->store.environment, false); rai::raw_key seed; existing->second->store.seed (seed, transaction); std::cout << boost::str (boost::format ("Seed: %1%\n") % seed.data.to_string ()); @@ -557,7 +557,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map for (auto i (node.node->wallets.items.begin ()), n (node.node->wallets.items.end ()); i != n; ++i) { std::cout << boost::str (boost::format ("Wallet ID: %1%\n") % i->first.to_string ()); - rai::transaction transaction (i->second->store.environment, nullptr, false); + rai::transaction transaction (i->second->store.environment, false); for (auto j (i->second->store.begin (transaction)), m (i->second->store.end ()); j != m; ++j) { std::cout << rai::uint256_union (j->first).to_account () << '\n'; @@ -578,7 +578,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map rai::account account_id; if (!account_id.decode_account (vm["account"].as ())) { - rai::transaction transaction (wallet->second->store.environment, nullptr, true); + rai::transaction transaction (wallet->second->store.environment, true); auto account (wallet->second->store.find (transaction, account_id)); if (account != wallet->second->store.end ()) { @@ -625,7 +625,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map auto wallet (node.node->wallets.items.find (wallet_id)); if (wallet != node.node->wallets.items.end ()) { - rai::transaction transaction (wallet->second->store.environment, nullptr, false); + rai::transaction transaction (wallet->second->store.environment, false); auto representative (wallet->second->store.representative (transaction)); std::cout << boost::str (boost::format ("Representative: %1%\n") % representative.to_account ()); } @@ -663,7 +663,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map auto wallet (node.node->wallets.items.find (wallet_id)); if (wallet != node.node->wallets.items.end ()) { - rai::transaction transaction (wallet->second->store.environment, nullptr, true); + rai::transaction transaction (wallet->second->store.environment, true); wallet->second->store.representative_set (transaction, account); } else @@ -699,7 +699,7 @@ std::error_code rai::handle_node_options (boost::program_options::variables_map else if (vm.count ("vote_dump") == 1) { inactive_node node (data_path); - rai::transaction transaction (node.node->store.environment, nullptr, false); + rai::transaction transaction (node.node->store.environment, false); for (auto i (node.node->store.vote_begin (transaction)), n (node.node->store.vote_end ()); i != n; ++i) { auto vote (i->second); diff --git a/rai/node/lmdb.cpp b/rai/node/lmdb.cpp index 52976419..96189935 100644 --- a/rai/node/lmdb.cpp +++ b/rai/node/lmdb.cpp @@ -264,7 +264,7 @@ rai::mdb_val::operator MDB_val const & () const return value; } -rai::transaction::transaction (rai::mdb_env & environment_a, MDB_txn * parent_a, bool write) : +rai::transaction::transaction (rai::mdb_env & environment_a, bool write, MDB_txn * parent_a) : environment (environment_a) { auto status (mdb_txn_begin (environment_a, parent_a, write ? 0 : MDB_RDONLY, &handle)); diff --git a/rai/node/lmdb.hpp b/rai/node/lmdb.hpp index 9c136223..2e1496ac 100644 --- a/rai/node/lmdb.hpp +++ b/rai/node/lmdb.hpp @@ -74,7 +74,7 @@ public: class transaction { public: - transaction (rai::mdb_env &, MDB_txn *, bool); + transaction (rai::mdb_env &, bool, MDB_txn * = nullptr); ~transaction (); operator MDB_txn * () const; MDB_txn * handle; diff --git a/rai/node/node.cpp b/rai/node/node.cpp index e84a9eda..5a0b50de 100644 --- a/rai/node/node.cpp +++ b/rai/node/node.cpp @@ -319,7 +319,7 @@ void rai::network::send_confirm_req (rai::endpoint const & endpoint_a, std::shar template void rep_query (rai::node & node_a, T const & peers_a) { - rai::transaction transaction (node_a.store.environment, nullptr, false); + rai::transaction transaction (node_a.store.environment, false); std::shared_ptr block (node_a.store.block_random (transaction)); auto hash (block->hash ()); node_a.rep_crawler.add (hash); @@ -395,7 +395,7 @@ public: node.peers.contacted (sender, message_a.header.version_using); node.process_active (message_a.block); node.active.publish (message_a.block); - rai::transaction transaction_a (node.store.environment, nullptr, false); + rai::transaction transaction_a (node.store.environment, false); auto successor (node.ledger.successor (transaction_a, message_a.block->root ())); if (successor != nullptr) { @@ -1250,7 +1250,7 @@ void rai::vote_processor::process_loop () active = true; lock.unlock (); { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto & i : votes_l) { vote_blocking (transaction, i.first, i.second); @@ -1478,7 +1478,7 @@ bool rai::block_processor::have_blocks () void rai::block_processor::process_receive_many (std::unique_lock & lock_a) { { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); lock_a.lock (); auto count (0); while (have_blocks () && count < 16384) @@ -1813,7 +1813,7 @@ stats (config.stat_config) rai::uint128_t rep_weight; rai::uint128_t min_rep_weight; { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); rep_weight = ledger.weight (transaction, vote_a->account); min_rep_weight = online_reps.online_stake () / 1000; } @@ -1855,7 +1855,7 @@ stats (config.stat_config) { BOOST_LOG (log) << "Constructing node"; } - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); if (store.latest_begin (transaction) == store.latest_end ()) { // Store was empty meaning we just created it, add the genesis block @@ -1875,7 +1875,7 @@ stats (config.stat_config) if (!rai::read (weight_stream, block_height)) { auto max_blocks = (uint64_t)block_height.number (); - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); if (ledger.store.block_count (transaction).sum () < max_blocks) { ledger.bootstrap_weight_max_blocks = max_blocks; @@ -1934,7 +1934,7 @@ void rai::node::process_fork (MDB_txn * transaction_a, std::shared_ptrbootstrap_initiator.current_attempt ()); if (attempt) { - rai::transaction transaction (this_l->store.environment, nullptr, false); + rai::transaction transaction (this_l->store.environment, false); auto account (this_l->ledger.store.frontier_get (transaction, root)); if (!account.is_zero ()) { @@ -1984,7 +1984,7 @@ void rai::gap_cache::add (MDB_txn * transaction_a, std::shared_ptr b void rai::gap_cache::vote (std::shared_ptr vote_a) { std::lock_guard lock (mutex); - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto hash : *vote_a) { auto existing (blocks.get<1> ().find (hash)); @@ -2004,7 +2004,7 @@ void rai::gap_cache::vote (std::shared_ptr vote_a) auto node_l (node.shared ()); auto now (std::chrono::steady_clock::now ()); node.alarm.add (rai::rai_network == rai::rai_networks::rai_test_network ? now + std::chrono::milliseconds (5) : now + std::chrono::seconds (5), [node_l, hash]() { - rai::transaction transaction (node_l->store.environment, nullptr, false); + rai::transaction transaction (node_l->store.environment, false); if (!node_l->store.block_exists (transaction, hash)) { if (!node_l->bootstrap_initiator.in_progress ()) @@ -2058,7 +2058,7 @@ void rai::node::process_active (std::shared_ptr incoming) rai::process_return rai::node::process (rai::block const & block_a) { - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); auto result (ledger.process (transaction, block_a)); return result; } @@ -2304,26 +2304,26 @@ void rai::node::keepalive_preconfigured (std::vector const & peers_ rai::block_hash rai::node::latest (rai::account const & account_a) { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); return ledger.latest (transaction, account_a); } rai::uint128_t rai::node::balance (rai::account const & account_a) { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); return ledger.account_balance (transaction, account_a); } std::unique_ptr rai::node::block (rai::block_hash const & hash_a) { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); return store.block_get (transaction, hash_a); } std::pair rai::node::balance_pending (rai::account const & account_a) { std::pair result; - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); result.first = ledger.account_balance (transaction, account_a); result.second = ledger.account_pending (transaction, account_a); return result; @@ -2331,13 +2331,13 @@ std::pair rai::node::balance_pending (rai::accou rai::uint128_t rai::node::weight (rai::account const & account_a) { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); return ledger.weight (transaction, account_a); } rai::account rai::node::representative (rai::account const & account_a) { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); rai::account_info info; rai::account result (0); if (!store.account_get (transaction, account_a, info)) @@ -2418,7 +2418,7 @@ void rai::node::ongoing_bootstrap () void rai::node::ongoing_store_flush () { { - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.flush (transaction); } std::weak_ptr node_w (shared_from_this ()); @@ -2432,7 +2432,7 @@ void rai::node::ongoing_store_flush () void rai::node::backup_wallet () { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); for (auto i (wallets.items.begin ()), n (wallets.items.end ()); i != n; ++i) { auto backup_path (application_path / "backup"); @@ -2844,13 +2844,13 @@ void rai::node::process_confirmed (std::shared_ptr block_a) // Attempt to process confirmed block if it's not in ledger yet if (!exists) { - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); block_processor.process_receive_one (transaction, block_a); exists = store.block_exists (transaction, hash); } if (exists) { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); confirmed_visitor visitor (transaction, *this, block_a, hash); block_a->visit (visitor); auto account (ledger.account (transaction, hash)); @@ -2925,7 +2925,7 @@ void rai::online_reps::vote (std::shared_ptr const & vote_a) auto rep (vote_a->account); std::lock_guard lock (mutex); auto now (std::chrono::steady_clock::now ()); - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto current (reps.begin ()); while (current != reps.end () && current->last_heard + std::chrono::seconds (rai::node::cutoff) < now) { @@ -2961,7 +2961,7 @@ void rai::online_reps::recalculate_stake () { std::lock_guard lock (mutex); online_stake_total = 0; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto it : reps) { online_stake_total += node.ledger.weight (transaction, it.representative); @@ -3626,7 +3626,7 @@ void rai::election::log_votes (rai::tally_t const & tally_a) rai::election_vote_result rai::election::vote (rai::account rep, uint64_t sequence, rai::block_hash block_hash) { // see republish_vote documentation for an explanation of these rules - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto replay (false); auto supply (node.online_reps.online_stake ()); auto weight (node.ledger.weight (transaction, rep)); @@ -3699,7 +3699,7 @@ bool rai::election::publish (std::shared_ptr block_a) void rai::active_transactions::announce_votes () { std::unordered_set inactive; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); unsigned unconfirmed_count (0); unsigned unconfirmed_announcements (0); unsigned mass_request_count (0); @@ -4001,7 +4001,7 @@ bool rai::active_transactions::publish (std::shared_ptr block_a) int rai::node::store_version () { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); return store.version_get (transaction); } diff --git a/rai/node/rpc.cpp b/rai/node/rpc.cpp index 744b585f..6c24b742 100644 --- a/rai/node/rpc.cpp +++ b/rai/node/rpc.cpp @@ -403,7 +403,7 @@ void rai::rpc_handler::account_block_count () auto account (account_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); rai::account_info info; if (!node.store.account_get (transaction, account, info)) { @@ -460,7 +460,7 @@ void rai::rpc_handler::account_info () const bool representative = request.get ("representative", false); const bool weight = request.get ("weight", false); const bool pending = request.get ("pending", false); - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); rai::account_info info; if (!node.store.account_get (transaction, account, info)) { @@ -514,7 +514,7 @@ void rai::rpc_handler::account_list () if (!ec) { boost::property_tree::ptree accounts; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (wallet->store.begin (transaction)), j (wallet->store.end ()); i != j; ++i) { boost::property_tree::ptree entry; @@ -548,7 +548,7 @@ void rai::rpc_handler::account_move () account.decode_hex (i->second.get ("")); accounts.push_back (account); } - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); auto error (wallet->store.move (transaction, source->store, accounts)); response_l.put ("moved", error ? "0" : "1"); } @@ -572,7 +572,7 @@ void rai::rpc_handler::account_remove () auto account (account_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); if (wallet->store.valid_password (transaction)) { if (wallet->store.find (transaction, account) != wallet->store.end ()) @@ -598,7 +598,7 @@ void rai::rpc_handler::account_representative () auto account (account_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); rai::account_info info; if (!node.store.account_get (transaction, account, info)) { @@ -630,7 +630,7 @@ void rai::rpc_handler::account_representative_set () auto work (work_optional_impl ()); if (!ec && work) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); rai::account_info info; if (!node.store.account_get (transaction, account, info)) { @@ -738,7 +738,7 @@ void rai::rpc_handler::accounts_create () void rai::rpc_handler::accounts_frontiers () { boost::property_tree::ptree frontiers; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto & accounts : request.get_child ("accounts")) { auto account (account_impl (accounts.second.data ())); @@ -762,7 +762,7 @@ void rai::rpc_handler::accounts_pending () const bool source = request.get ("source", false); const bool include_active = request.get ("include_active", false); boost::property_tree::ptree pending; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto & accounts : request.get_child ("accounts")) { auto account (account_impl (accounts.second.data ())); @@ -826,7 +826,7 @@ void rai::rpc_handler::block () auto hash (hash_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto block (node.store.block_get (transaction, hash)); if (block != nullptr) { @@ -847,7 +847,7 @@ void rai::rpc_handler::block_confirm () auto hash (hash_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto block_l (node.store.block_get (transaction, hash)); if (block_l != nullptr) { @@ -866,7 +866,7 @@ void rai::rpc_handler::blocks () { std::vector hashes; boost::property_tree::ptree blocks; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (boost::property_tree::ptree::value_type & hashes : request.get_child ("hashes")) { if (!ec) @@ -904,7 +904,7 @@ void rai::rpc_handler::blocks_info () const bool balance = request.get ("balance", false); std::vector hashes; boost::property_tree::ptree blocks; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (boost::property_tree::ptree::value_type & hashes : request.get_child ("hashes")) { if (!ec) @@ -975,7 +975,7 @@ void rai::rpc_handler::block_account () auto hash (hash_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); if (node.store.block_exists (transaction, hash)) { auto account (node.ledger.account (transaction, hash)); @@ -991,7 +991,7 @@ void rai::rpc_handler::block_account () void rai::rpc_handler::block_count () { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); response_l.put ("count", std::to_string (node.store.block_count (transaction).sum ())); response_l.put ("unchecked", std::to_string (node.store.unchecked_count (transaction))); response_errors (); @@ -999,7 +999,7 @@ void rai::rpc_handler::block_count () void rai::rpc_handler::block_count_type () { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); rai::block_counts count (node.store.block_count (transaction)); response_l.put ("send", std::to_string (count.send)); response_l.put ("receive", std::to_string (count.receive)); @@ -1081,7 +1081,7 @@ void rai::rpc_handler::block_create () auto existing (node.wallets.items.find (wallet)); if (existing != node.wallets.items.end ()) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); if (existing->second->store.valid_password (transaction)) { if (existing->second->store.find (transaction, account) != existing->second->store.end ()) @@ -1152,14 +1152,14 @@ void rai::rpc_handler::block_create () // Fetching account balance & previous for send blocks (if aren't given directly) if (!previous_text.is_initialized () && !balance_text.is_initialized ()) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); previous = node.ledger.latest (transaction, pub); balance = node.ledger.account_balance (transaction, pub); } // Double check current balance if previous block is specified else if (previous_text.is_initialized () && balance_text.is_initialized () && type == "send") { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); if (node.store.block_exists (transaction, previous) && node.store.block_balance (transaction, previous) != balance.number ()) { ec = nano::error_rpc::block_create_balance_mismatch; @@ -1348,7 +1348,7 @@ void rai::rpc_handler::chain (bool successors) if (!ec) { boost::property_tree::ptree blocks; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); while (!hash.is_zero () && blocks.size () < count) { auto block_l (node.store.block_get (transaction, hash)); @@ -1392,7 +1392,7 @@ void rai::rpc_handler::delegators () if (!ec) { boost::property_tree::ptree delegators; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (node.store.latest_begin (transaction)), n (node.store.latest_end ()); i != n; ++i) { rai::account_info info (i->second); @@ -1416,7 +1416,7 @@ void rai::rpc_handler::delegators_count () if (!ec) { uint64_t count (0); - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (node.store.latest_begin (transaction)), n (node.store.latest_end ()); i != n; ++i) { rai::account_info info (i->second); @@ -1468,7 +1468,7 @@ void rai::rpc_handler::frontiers () if (!ec) { boost::property_tree::ptree frontiers; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (node.store.latest_begin (transaction, start)), n (node.store.latest_end ()); i != n && frontiers.size () < count; ++i) { frontiers.put (rai::account (i->first).to_account (), rai::account_info (i->second).head.to_string ()); @@ -1480,7 +1480,7 @@ void rai::rpc_handler::frontiers () void rai::rpc_handler::account_count () { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto size (node.store.account_count (transaction)); response_l.put ("count", std::to_string (size)); response_errors (); @@ -1632,7 +1632,7 @@ void rai::rpc_handler::account_history () bool output_raw (request.get_optional ("raw") == true); rai::block_hash hash; auto head_str (request.get_optional ("head")); - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); if (head_str) { if (!hash.decode_hex (*head_str)) @@ -1776,7 +1776,7 @@ void rai::rpc_handler::ledger () const bool weight = request.get ("weight", false); const bool pending = request.get ("pending", false); boost::property_tree::ptree accounts; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); if (!ec && !sorting) // Simple { for (auto i (node.store.latest_begin (transaction, start)), n (node.store.latest_end ()); i != n && accounts.size () < count; ++i) @@ -1901,7 +1901,7 @@ void rai::rpc_handler::password_change () auto wallet (wallet_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); std::string password_text (request.get ("password")); auto error (wallet->store.rekey (transaction, password_text)); response_l.put ("changed", error ? "0" : "1"); @@ -1926,7 +1926,7 @@ void rai::rpc_handler::password_valid (bool wallet_locked) auto wallet (wallet_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto valid (wallet->store.valid_password (transaction)); if (!wallet_locked) { @@ -1964,7 +1964,7 @@ void rai::rpc_handler::pending () if (!ec) { boost::property_tree::ptree peers_l; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); rai::account end (account.number () + 1); for (auto i (node.store.pending_begin (transaction, rai::pending_key (account, 0))), n (node.store.pending_begin (transaction, rai::pending_key (end, 0))); i != n && peers_l.size () < count; ++i) { @@ -2011,7 +2011,7 @@ void rai::rpc_handler::pending_exists () auto hash (hash_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto block (node.store.block_get (transaction, hash)); if (block != nullptr) { @@ -2040,7 +2040,7 @@ void rai::rpc_handler::payment_begin () auto existing (node.wallets.items.find (id)); if (existing != node.wallets.items.end ()) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); std::shared_ptr wallet (existing->second); if (wallet->store.valid_password (transaction)) { @@ -2103,7 +2103,7 @@ void rai::rpc_handler::payment_init () auto wallet (wallet_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); if (wallet->store.valid_password (transaction)) { wallet->init_free_accounts (transaction); @@ -2123,7 +2123,7 @@ void rai::rpc_handler::payment_end () auto wallet (wallet_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto existing (wallet->store.find (transaction, account)); if (existing != wallet->store.end ()) { @@ -2190,7 +2190,7 @@ void rai::rpc_handler::process () node.block_arrival.add (hash); rai::process_return result; { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); result = node.block_processor.process_receive_one (transaction, block, std::chrono::steady_clock::time_point ()); } switch (result.code) @@ -2283,7 +2283,7 @@ void rai::rpc_handler::receive () auto hash (hash_impl ("block")); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); if (wallet->store.valid_password (transaction)) { if (wallet->store.find (transaction, account) != wallet->store.end ()) @@ -2308,7 +2308,7 @@ void rai::rpc_handler::receive () } if (!rai::work_validate (head, work)) { - rai::transaction transaction_a (node.store.environment, nullptr, true); + rai::transaction transaction_a (node.store.environment, true); wallet->store.work_put (transaction_a, account, work); } else @@ -2388,7 +2388,7 @@ void rai::rpc_handler::representatives () { const bool sorting = request.get ("sorting", false); boost::property_tree::ptree representatives; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); if (!sorting) // Simple { for (auto i (node.store.representation_begin (transaction)), n (node.store.representation_end ()); i != n && representatives.size () < count; ++i) @@ -2456,7 +2456,7 @@ void rai::rpc_handler::republish () if (!ec) { boost::property_tree::ptree blocks; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto block (node.store.block_get (transaction, hash)); if (block != nullptr) { @@ -2580,7 +2580,7 @@ void rai::rpc_handler::send () rai::uint128_t balance (0); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, work != 0); // false if no "work" in request, true if work > 0 + rai::transaction transaction (node.store.environment, work != 0); // false if no "work" in request, true if work > 0 rai::account_info info; if (!node.store.account_get (transaction, source, info)) { @@ -2700,7 +2700,7 @@ void rai::rpc_handler::unchecked () if (!ec) { boost::property_tree::ptree unchecked; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (node.store.unchecked_begin (transaction)), n (node.store.unchecked_end ()); i != n && unchecked.size () < count; ++i) { auto block (i->second); @@ -2718,7 +2718,7 @@ void rai::rpc_handler::unchecked_clear () rpc_control_impl (); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); node.store.unchecked_clear (transaction); response_l.put ("success", ""); } @@ -2730,7 +2730,7 @@ void rai::rpc_handler::unchecked_get () auto hash (hash_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (node.store.unchecked_begin (transaction)), n (node.store.unchecked_end ()); i != n; ++i) { std::shared_ptr block (i->second); @@ -2765,7 +2765,7 @@ void rai::rpc_handler::unchecked_keys () if (!ec) { boost::property_tree::ptree unchecked; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (node.store.unchecked_begin (transaction, key)), n (node.store.unchecked_end ()); i != n && unchecked.size () < count; ++i) { boost::property_tree::ptree entry; @@ -2834,7 +2834,7 @@ void rai::rpc_handler::wallet_add_watch () auto wallet (wallet_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); if (wallet->store.valid_password (transaction)) { for (auto & accounts : request.get_child ("accounts")) @@ -2865,7 +2865,7 @@ void rai::rpc_handler::wallet_info () uint64_t count (0); uint64_t deterministic_count (0); uint64_t adhoc_count (0); - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i) { rai::account account (i->first); @@ -2900,7 +2900,7 @@ void rai::rpc_handler::wallet_balances () if (!ec) { boost::property_tree::ptree balances; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i) { rai::account account (i->first); @@ -2929,7 +2929,7 @@ void rai::rpc_handler::wallet_change_seed () rai::raw_key seed; if (!seed.data.decode_hex (seed_text)) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); if (wallet->store.valid_password (transaction)) { wallet->change_seed (transaction, seed); @@ -2954,7 +2954,7 @@ void rai::rpc_handler::wallet_contains () auto wallet (wallet_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto exists (wallet->store.find (transaction, account) != wallet->store.end ()); response_l.put ("exists", exists ? "1" : "0"); } @@ -2968,7 +2968,7 @@ void rai::rpc_handler::wallet_create () { rai::keypair wallet_id; node.wallets.create (wallet_id.pub); - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto existing (node.wallets.items.find (wallet_id.pub)); if (existing != node.wallets.items.end ()) { @@ -3016,7 +3016,7 @@ void rai::rpc_handler::wallet_export () auto wallet (wallet_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); std::string json; wallet->store.serialize_json (transaction, json); response_l.put ("json", json); @@ -3030,7 +3030,7 @@ void rai::rpc_handler::wallet_frontiers () if (!ec) { boost::property_tree::ptree frontiers; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i) { rai::account account (i->first); @@ -3050,7 +3050,7 @@ void rai::rpc_handler::wallet_key_valid () auto wallet (wallet_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto valid (wallet->store.valid_password (transaction)); response_l.put ("valid", valid ? "1" : "0"); } @@ -3072,7 +3072,7 @@ void rai::rpc_handler::wallet_ledger () if (!ec) { boost::property_tree::ptree accounts; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i) { rai::account account (i->first); @@ -3140,7 +3140,7 @@ void rai::rpc_handler::wallet_pending () if (!ec) { boost::property_tree::ptree pending; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i) { rai::account account (i->first); @@ -3201,7 +3201,7 @@ void rai::rpc_handler::wallet_representative () auto wallet (wallet_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); response_l.put ("representative", wallet->store.representative (transaction).to_account ()); } response_errors (); @@ -3217,7 +3217,7 @@ void rai::rpc_handler::wallet_representative_set () rai::account representative; if (!representative.decode_account (representative_text)) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); wallet->store.representative_set (transaction, representative); response_l.put ("set", "1"); } @@ -3237,7 +3237,7 @@ void rai::rpc_handler::wallet_republish () if (!ec) { boost::property_tree::ptree blocks; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i) { rai::account account (i->first); @@ -3272,7 +3272,7 @@ void rai::rpc_handler::wallet_work_get () if (!ec) { boost::property_tree::ptree works; - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i) { rai::account account (i->first); @@ -3339,7 +3339,7 @@ void rai::rpc_handler::work_get () auto account (account_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); if (wallet->store.find (transaction, account) != wallet->store.end ()) { uint64_t work (0); @@ -3362,7 +3362,7 @@ void rai::rpc_handler::work_set () auto work (work_optional_impl ()); if (!ec) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); if (wallet->store.find (transaction, account) != wallet->store.end ()) { wallet->store.work_put (transaction, account, work); diff --git a/rai/node/testing.cpp b/rai/node/testing.cpp index 65c79d0a..d5f52af1 100644 --- a/rai/node/testing.cpp +++ b/rai/node/testing.cpp @@ -166,7 +166,7 @@ void rai::system::generate_usage_traffic (uint32_t count_a, uint32_t wait_a, siz void rai::system::generate_rollback (rai::node & node_a, std::vector & accounts_a) { - rai::transaction transaction (node_a.store.environment, nullptr, true); + rai::transaction transaction (node_a.store.environment, true); auto index (random_pool.GenerateWord32 (0, accounts_a.size () - 1)); auto account (accounts_a[index]); rai::account_info info; @@ -188,7 +188,7 @@ void rai::system::generate_receive (rai::node & node_a) { std::shared_ptr send_block; { - rai::transaction transaction (node_a.store.environment, nullptr, false); + rai::transaction transaction (node_a.store.environment, false); rai::uint256_union random_block; random_pool.GenerateBlock (random_block.bytes.data (), sizeof (random_block.bytes)); auto i (node_a.store.pending_begin (transaction, rai::pending_key (random_block, 0))); @@ -261,7 +261,7 @@ void rai::system::generate_send_existing (rai::node & node_a, std::vector entry (node_a.store.latest_begin (transaction, account)); if (entry == node_a.store.latest_end ()) { @@ -308,7 +308,7 @@ void rai::system::generate_send_new (rai::node & node_a, std::vector temp; { - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); rai::uint256_union id; random_pool.GenerateBlock (id.bytes.data (), id.bytes.size ()); temp.reset (new rai::wallet_store (error, node.wallets.kdf, transaction, 0, 1, id.to_string (), json_a)); } if (!error) { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); error = temp->attempt_password (transaction, password_a); } - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); if (!error) { error = store.import (transaction, *temp); @@ -875,7 +875,7 @@ bool rai::wallet::import (std::string const & json_a, std::string const & passwo void rai::wallet::serialize (std::string & json_a) { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); store.serialize_json (transaction, json_a); } @@ -892,7 +892,7 @@ std::shared_ptr rai::wallet::receive_action (rai::block const & send std::shared_ptr block; if (node.config.receive_minimum.number () <= amount_a.number ()) { - rai::transaction transaction (node.ledger.store.environment, nullptr, false); + rai::transaction transaction (node.ledger.store.environment, false); rai::pending_info pending_info; if (node.store.block_exists (transaction, hash)) { @@ -957,7 +957,7 @@ std::shared_ptr rai::wallet::change_action (rai::account const & sou { std::shared_ptr block; { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); if (store.valid_password (transaction)) { auto existing (store.find (transaction, source_a)); @@ -1002,7 +1002,7 @@ std::shared_ptr rai::wallet::send_action (rai::account const & sourc bool error = false; bool cached_block = false; { - rai::transaction transaction (store.environment, nullptr, (bool)id_mdb_val); + rai::transaction transaction (store.environment, (bool)id_mdb_val); if (id_mdb_val) { rai::mdb_val result; @@ -1154,14 +1154,14 @@ void rai::wallet::work_ensure (rai::account const & account_a, rai::block_hash c bool rai::wallet::search_pending () { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); auto result (!store.valid_password (transaction)); if (!result) { BOOST_LOG (node.log) << "Beginning pending block search"; for (auto i (store.begin (transaction)), n (store.end ()); i != n; ++i) { - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); rai::account account (i->first); // Don't search pending for watch-only accounts if (!rai::wallet_value (i->second).key.is_zero ()) @@ -1246,7 +1246,7 @@ void rai::wallet::work_cache_blocking (rai::account const & account_a, rai::bloc { BOOST_LOG (node.log) << "Work generation complete: " << (std::chrono::duration_cast (std::chrono::steady_clock::now () - begin).count ()) << " us"; } - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); if (store.exists (transaction, account_a)) { work_update (transaction, account_a, root_a, work); @@ -1261,7 +1261,7 @@ thread ([this]() { do_wallet_actions (); }) { if (!error_a) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); auto status (mdb_dbi_open (transaction, nullptr, MDB_CREATE, &handle)); status |= mdb_dbi_open (transaction, "send_action_ids", MDB_CREATE, &send_action_ids); assert (status == 0); @@ -1315,7 +1315,7 @@ std::shared_ptr rai::wallets::create (rai::uint256_union const & id std::shared_ptr result; bool error; { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); result = std::make_shared (error, transaction, node, id_a.to_string ()); } if (!error) @@ -1349,7 +1349,7 @@ void rai::wallets::search_pending_all () void rai::wallets::destroy (rai::uint256_union const & id_a) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); auto existing (items.find (id_a)); assert (existing != items.end ()); auto wallet (existing->second); diff --git a/rai/qt/qt.cpp b/rai/qt/qt.cpp index 9768b9ef..a74e322b 100644 --- a/rai/qt/qt.cpp +++ b/rai/qt/qt.cpp @@ -184,7 +184,7 @@ wallet (wallet_a) this->wallet.pop_main_stack (); }); QObject::connect (create_account, &QPushButton::released, [this]() { - rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); + rai::transaction transaction (this->wallet.wallet_m->store.environment, true); if (this->wallet.wallet_m->store.valid_password (transaction)) { this->wallet.wallet_m->deterministic_insert (transaction); @@ -215,7 +215,7 @@ wallet (wallet_a) }); QObject::connect (backup_seed, &QPushButton::released, [this]() { rai::raw_key seed; - rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, false); + rai::transaction transaction (this->wallet.wallet_m->store.environment, false); if (this->wallet.wallet_m->store.valid_password (transaction)) { this->wallet.wallet_m->store.seed (seed, transaction); @@ -252,7 +252,7 @@ wallet (wallet_a) void rai_qt::accounts::refresh_wallet_balance () { - rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, false); + rai::transaction transaction (this->wallet.wallet_m->store.environment, false); rai::uint128_t balance (0); rai::uint128_t pending (0); for (auto i (this->wallet.wallet_m->store.begin (transaction)), j (this->wallet.wallet_m->store.end ()); i != j; ++i) @@ -277,7 +277,7 @@ void rai_qt::accounts::refresh_wallet_balance () void rai_qt::accounts::refresh () { model->removeRows (0, model->rowCount ()); - rai::transaction transaction (wallet.wallet_m->store.environment, nullptr, false); + rai::transaction transaction (wallet.wallet_m->store.environment, false); QBrush brush; for (auto i (wallet.wallet_m->store.begin (transaction)), j (wallet.wallet_m->store.end ()); i != j; ++i) { @@ -380,7 +380,7 @@ wallet (wallet_a) { bool successful (false); { - rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); + rai::transaction transaction (this->wallet.wallet_m->store.environment, true); if (this->wallet.wallet_m->store.valid_password (transaction)) { this->wallet.account = this->wallet.wallet_m->change_seed (transaction, seed_l); @@ -576,7 +576,7 @@ public: void rai_qt::history::refresh () { - rai::transaction transaction (ledger.store.environment, nullptr, false); + rai::transaction transaction (ledger.store.environment, false); model->removeRows (0, model->rowCount ()); auto hash (ledger.latest (transaction, account)); short_text_visitor visitor (transaction, ledger); @@ -629,7 +629,7 @@ wallet (wallet_a) rai::block_hash hash_l; if (!hash_l.decode_hex (hash->text ().toStdString ())) { - rai::transaction transaction (this->wallet.node.store.environment, nullptr, false); + rai::transaction transaction (this->wallet.node.store.environment, false); auto block_l (this->wallet.node.store.block_get (transaction, hash_l)); if (block_l != nullptr) { @@ -654,7 +654,7 @@ wallet (wallet_a) auto error (block.decode_hex (hash->text ().toStdString ())); if (!error) { - rai::transaction transaction (this->wallet.node.store.environment, nullptr, false); + rai::transaction transaction (this->wallet.node.store.environment, false); if (this->wallet.node.store.block_exists (transaction, block)) { rebroadcast->setEnabled (false); @@ -675,7 +675,7 @@ wallet (wallet_a) void rai_qt::block_viewer::rebroadcast_action (rai::uint256_union const & hash_a) { auto done (true); - rai::transaction transaction (wallet.node.ledger.store.environment, nullptr, false); + rai::transaction transaction (wallet.node.ledger.store.environment, false); auto block (wallet.node.store.block_get (transaction, hash_a)); if (block != nullptr) { @@ -870,7 +870,7 @@ std::string rai_qt::status::text () size_t unchecked (0); std::string count_string; { - rai::transaction transaction (wallet.wallet_m->node.store.environment, nullptr, false); + rai::transaction transaction (wallet.wallet_m->node.store.environment, false); auto size (wallet.wallet_m->node.store.block_count (transaction)); unchecked = wallet.wallet_m->node.store.unchecked_count (transaction); count_string = std::to_string (size.sum ()); @@ -1084,7 +1084,7 @@ void rai_qt::wallet::start () auto balance (this_l->node.balance (this_l->account)); if (actual <= balance) { - rai::transaction transaction (this_l->wallet_m->store.environment, nullptr, false); + rai::transaction transaction (this_l->wallet_m->store.environment, false); if (this_l->wallet_m->store.valid_password (transaction)) { this_l->send_blocks_send->setEnabled (false); @@ -1352,7 +1352,7 @@ void rai_qt::wallet::start () void rai_qt::wallet::refresh () { { - rai::transaction transaction (wallet_m->store.environment, nullptr, false); + rai::transaction transaction (wallet_m->store.environment, false); assert (wallet_m->store.exists (transaction, account)); } self.account_text->setText (QString (account.to_account ().c_str ())); @@ -1460,7 +1460,7 @@ wallet (wallet_a) layout->addWidget (back); window->setLayout (layout); QObject::connect (change, &QPushButton::released, [this]() { - rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); + rai::transaction transaction (this->wallet.wallet_m->store.environment, true); if (this->wallet.wallet_m->store.valid_password (transaction)) { if (new_password->text ().isEmpty ()) @@ -1511,12 +1511,12 @@ wallet (wallet_a) rai::account representative_l; if (!representative_l.decode_account (new_representative->text ().toStdString ())) { - rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, false); + rai::transaction transaction (this->wallet.wallet_m->store.environment, false); if (this->wallet.wallet_m->store.valid_password (transaction)) { change_rep->setEnabled (false); { - rai::transaction transaction_l (this->wallet.wallet_m->store.environment, nullptr, true); + rai::transaction transaction_l (this->wallet.wallet_m->store.environment, true); this->wallet.wallet_m->store.representative_set (transaction_l, representative_l); } auto block (this->wallet.wallet_m->change_sync (this->wallet.account, representative_l)); @@ -1563,7 +1563,7 @@ wallet (wallet_a) this->wallet.pop_main_stack (); }); QObject::connect (lock_toggle, &QPushButton::released, [this]() { - rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); + rai::transaction transaction (this->wallet.wallet_m->store.environment, true); if (this->wallet.wallet_m->store.valid_password (transaction)) { // lock wallet @@ -1594,7 +1594,7 @@ wallet (wallet_a) show_button_ok (*lock_toggle); // if wallet is still not unlocked by now, change button text - rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); + rai::transaction transaction (this->wallet.wallet_m->store.environment, true); if (!this->wallet.wallet_m->store.valid_password (transaction)) { lock_toggle->setText ("Unlock"); @@ -1611,7 +1611,7 @@ wallet (wallet_a) }); // initial state for lock toggle button - rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); + rai::transaction transaction (this->wallet.wallet_m->store.environment, true); if (this->wallet.wallet_m->store.valid_password (transaction)) { lock_toggle->setText ("Lock"); @@ -1624,7 +1624,7 @@ wallet (wallet_a) void rai_qt::settings::refresh_representative () { - rai::transaction transaction (this->wallet.wallet_m->node.store.environment, nullptr, false); + rai::transaction transaction (this->wallet.wallet_m->node.store.environment, false); rai::account_info info; auto error (this->wallet.wallet_m->node.store.account_get (transaction, this->wallet.account, info)); if (!error) @@ -1876,7 +1876,7 @@ void rai_qt::advanced_actions::refresh_peers () void rai_qt::advanced_actions::refresh_ledger () { ledger_model->removeRows (0, ledger_model->rowCount ()); - rai::transaction transaction (wallet.node.store.environment, nullptr, false); + rai::transaction transaction (wallet.node.store.environment, false); for (auto i (wallet.node.ledger.store.latest_begin (transaction)), j (wallet.node.ledger.store.latest_end ()); i != j; ++i) { QList items; @@ -2137,7 +2137,7 @@ void rai_qt::block_creation::create_send () error = destination_l.decode_account (destination->text ().toStdString ()); if (!error) { - rai::transaction transaction (wallet.node.store.environment, nullptr, false); + rai::transaction transaction (wallet.node.store.environment, false); rai::raw_key key; if (!wallet.wallet_m->store.fetch (transaction, account_l, key)) { @@ -2194,7 +2194,7 @@ void rai_qt::block_creation::create_receive () auto error (source_l.decode_hex (source->text ().toStdString ())); if (!error) { - rai::transaction transaction (wallet.node.store.environment, nullptr, false); + rai::transaction transaction (wallet.node.store.environment, false); auto block_l (wallet.node.store.block_get (transaction, source_l)); if (block_l != nullptr) { @@ -2270,7 +2270,7 @@ void rai_qt::block_creation::create_change () error = representative_l.decode_account (representative->text ().toStdString ()); if (!error) { - rai::transaction transaction (wallet.node.store.environment, nullptr, false); + rai::transaction transaction (wallet.node.store.environment, false); rai::account_info info; auto error (wallet.node.store.account_get (transaction, account_l, info)); if (!error) @@ -2322,7 +2322,7 @@ void rai_qt::block_creation::create_open () error = representative_l.decode_account (representative->text ().toStdString ()); if (!error) { - rai::transaction transaction (wallet.node.store.environment, nullptr, false); + rai::transaction transaction (wallet.node.store.environment, false); auto block_l (wallet.node.store.block_get (transaction, source_l)); if (block_l != nullptr) { diff --git a/rai/qt_test/qt.cpp b/rai/qt_test/qt.cpp index 770e318f..4f24179d 100644 --- a/rai/qt_test/qt.cpp +++ b/rai/qt_test/qt.cpp @@ -133,14 +133,14 @@ TEST (wallet, password_change) rai::account account; system.wallet (0)->insert_adhoc (rai::keypair ().prv); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); account = system.account (transaction, 0); } auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), account)); wallet->start (); QTest::mouseClick (wallet->settings_button, Qt::LeftButton); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); rai::raw_key password1; rai::raw_key password2; system.wallet (0)->store.derive_key (password1, transaction, "1"); @@ -151,7 +151,7 @@ TEST (wallet, password_change) QTest::keyClicks (wallet->settings.retype_password, "1"); QTest::mouseClick (wallet->settings.change, Qt::LeftButton); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); rai::raw_key password1; rai::raw_key password2; system.wallet (0)->store.derive_key (password1, transaction, "1"); @@ -169,7 +169,7 @@ TEST (client, password_nochange) rai::account account; system.wallet (0)->insert_adhoc (rai::keypair ().prv); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); account = system.account (transaction, 0); } auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), account)); @@ -184,7 +184,7 @@ TEST (client, password_nochange) system.wallet (0)->store.password.value (password); } { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); rai::raw_key password1; system.wallet (0)->store.derive_key (password1, transaction, ""); rai::raw_key password2; @@ -195,7 +195,7 @@ TEST (client, password_nochange) QTest::keyClicks (wallet->settings.retype_password, "2"); QTest::mouseClick (wallet->settings.change, Qt::LeftButton); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); rai::raw_key password1; system.wallet (0)->store.derive_key (password1, transaction, ""); rai::raw_key password2; @@ -213,7 +213,7 @@ TEST (wallet, enter_password) rai::account account; system.wallet (0)->insert_adhoc (rai::keypair ().prv); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); account = system.account (transaction, 0); } auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), account)); @@ -228,7 +228,7 @@ TEST (wallet, enter_password) test_application->processEvents (); ASSERT_EQ ("Status: Wallet password empty, Block: 1", wallet->status->text ().toStdString ()); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); ASSERT_FALSE (system.wallet (0)->store.rekey (transaction, "abc")); } QTest::mouseClick (wallet->settings_button, Qt::LeftButton); @@ -305,7 +305,7 @@ TEST (wallet, process_block) rai::block_hash latest (system.nodes[0]->latest (rai::genesis_account)); system.wallet (0)->insert_adhoc (rai::keypair ().prv); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); account = system.account (transaction, 0); } auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), account)); @@ -330,7 +330,7 @@ TEST (wallet, process_block) QTest::keyClicks (wallet->block_entry.block, QString::fromStdString (block_json)); QTest::mouseClick (wallet->block_entry.process, Qt::LeftButton); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); system.deadline_set (10s); while (system.nodes[0]->store.block_exists (transaction, send.hash ())) { @@ -457,7 +457,7 @@ TEST (history, short_text) system.wallet (0)->insert_adhoc (key.prv); rai::account account; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); account = system.account (transaction, 0); } auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), account)); @@ -466,7 +466,7 @@ TEST (history, short_text) rai::genesis genesis; rai::ledger ledger (store, system.nodes[0]->stats); { - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key; rai::send_block send (ledger.latest (transaction, rai::test_genesis_key.pub), rai::test_genesis_key.pub, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); @@ -489,7 +489,7 @@ TEST (wallet, startup_work) system.wallet (0)->insert_adhoc (key.prv); rai::account account; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); account = system.account (transaction, 0); } auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), account)); @@ -497,7 +497,7 @@ TEST (wallet, startup_work) QTest::mouseClick (wallet->show_advanced, Qt::LeftButton); uint64_t work1; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); ASSERT_TRUE (wallet->wallet_m->store.work_get (transaction, rai::test_genesis_key.pub, work1)); } QTest::mouseClick (wallet->accounts_button, Qt::LeftButton); @@ -508,7 +508,7 @@ TEST (wallet, startup_work) while (again) { ASSERT_NO_ERROR (system.poll ()); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); again = wallet->wallet_m->store.work_get (transaction, rai::test_genesis_key.pub, work1); } } @@ -521,7 +521,7 @@ TEST (wallet, block_viewer) system.wallet (0)->insert_adhoc (key.prv); rai::account account; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); account = system.account (transaction, 0); } auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), account)); @@ -547,7 +547,7 @@ TEST (wallet, import) rai::keypair key2; system.wallet (0)->insert_adhoc (key1.prv); { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); system.wallet (0)->store.serialize_json (transaction, json); } system.wallet (1)->insert_adhoc (key2.prv); @@ -580,7 +580,7 @@ TEST (wallet, republish) rai::keypair key; rai::block_hash hash; { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); rai::send_block block (system.nodes[0]->ledger.latest (transaction, rai::test_genesis_key.pub), key.pub, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0); hash = block.hash (); ASSERT_EQ (rai::process_result::progress, system.nodes[0]->ledger.process (transaction, block).code); @@ -636,7 +636,7 @@ TEST (wallet, change_seed) auto key1 (system.wallet (0)->deterministic_insert ()); auto key3 (system.wallet (0)->deterministic_insert ()); rai::raw_key seed3; - system.wallet (0)->store.seed (seed3, rai::transaction (system.wallet (0)->store.environment, nullptr, false)); + system.wallet (0)->store.seed (seed3, rai::transaction (system.wallet (0)->store.environment, false)); auto wallet_key (key1); auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), wallet_key)); wallet->start (); @@ -650,7 +650,7 @@ TEST (wallet, change_seed) seed.data.clear (); QTest::keyClicks (wallet->import.seed, seed.data.to_string ().c_str ()); rai::raw_key seed1; - system.wallet (0)->store.seed (seed1, rai::transaction (system.wallet (0)->store.environment, nullptr, false)); + system.wallet (0)->store.seed (seed1, rai::transaction (system.wallet (0)->store.environment, false)); ASSERT_NE (seed, seed1); ASSERT_TRUE (system.wallet (0)->exists (key1)); ASSERT_EQ (2, wallet->accounts.model->rowCount ()); @@ -661,7 +661,7 @@ TEST (wallet, change_seed) ASSERT_EQ (1, wallet->accounts.model->rowCount ()); ASSERT_TRUE (wallet->import.clear_line->text ().toStdString ().empty ()); rai::raw_key seed2; - system.wallet (0)->store.seed (seed2, rai::transaction (system.wallet (0)->store.environment, nullptr, false)); + system.wallet (0)->store.seed (seed2, rai::transaction (system.wallet (0)->store.environment, false)); ASSERT_EQ (seed, seed2); ASSERT_FALSE (system.wallet (0)->exists (key1)); ASSERT_NE (key1, wallet->account); @@ -693,17 +693,17 @@ TEST (wallet, seed_work_generation) QTest::keyClicks (wallet->import.seed, seed.data.to_string ().c_str ()); QTest::keyClicks (wallet->import.clear_line, "clear keys"); uint64_t work_start; - system.wallet (0)->store.work_get (rai::transaction (system.wallet (0)->store.environment, nullptr, false), key1, work_start); + system.wallet (0)->store.work_get (rai::transaction (system.wallet (0)->store.environment, false), key1, work_start); uint64_t work (work_start); QTest::mouseClick (wallet->import.import_seed, Qt::LeftButton); system.deadline_set (10s); while (work == work_start) { auto ec = system.poll (); - system.wallet (0)->store.work_get (rai::transaction (system.wallet (0)->store.environment, nullptr, false), key1, work); + system.wallet (0)->store.work_get (rai::transaction (system.wallet (0)->store.environment, false), key1, work); ASSERT_NO_ERROR (ec); } - ASSERT_FALSE (rai::work_validate (system.nodes[0]->ledger.latest_root (rai::transaction (system.wallet (0)->store.environment, nullptr, false), key1), work)); + ASSERT_FALSE (rai::work_validate (system.nodes[0]->ledger.latest_root (rai::transaction (system.wallet (0)->store.environment, false), key1), work)); } TEST (wallet, backup_seed) @@ -719,7 +719,7 @@ TEST (wallet, backup_seed) ASSERT_EQ (wallet->accounts.window, wallet->main_stack->currentWidget ()); QTest::mouseClick (wallet->accounts.backup_seed, Qt::LeftButton); rai::raw_key seed; - system.wallet (0)->store.seed (seed, rai::transaction (system.wallet (0)->store.environment, nullptr, false)); + system.wallet (0)->store.seed (seed, rai::transaction (system.wallet (0)->store.environment, false)); ASSERT_EQ (seed.data.to_string (), test_application->clipboard ()->text ().toStdString ()); } @@ -728,7 +728,7 @@ TEST (wallet, import_locked) rai_qt::eventloop_processor processor; rai::system system (24000, 1); auto key1 (system.wallet (0)->deterministic_insert ()); - system.wallet (0)->store.rekey (rai::transaction (system.wallet (0)->store.environment, nullptr, true), "1"); + system.wallet (0)->store.rekey (rai::transaction (system.wallet (0)->store.environment, true), "1"); auto wallet (std::make_shared (*test_application, processor, *system.nodes[0], system.wallet (0), key1)); wallet->start (); QTest::mouseClick (wallet->show_advanced, Qt::LeftButton); @@ -742,12 +742,12 @@ TEST (wallet, import_locked) system.wallet (0)->enter_password (""); QTest::mouseClick (wallet->import.import_seed, Qt::LeftButton); rai::raw_key seed2; - system.wallet (0)->store.seed (seed2, rai::transaction (system.wallet (0)->store.environment, nullptr, false)); + system.wallet (0)->store.seed (seed2, rai::transaction (system.wallet (0)->store.environment, false)); ASSERT_NE (seed1, seed2); system.wallet (0)->enter_password ("1"); QTest::mouseClick (wallet->import.import_seed, Qt::LeftButton); rai::raw_key seed3; - system.wallet (0)->store.seed (seed3, rai::transaction (system.wallet (0)->store.environment, nullptr, false)); + system.wallet (0)->store.seed (seed3, rai::transaction (system.wallet (0)->store.environment, false)); ASSERT_EQ (seed1, seed3); } // DISABLED: this always fails @@ -760,7 +760,7 @@ TEST (wallet, DISABLED_synchronizing) auto wallet (std::make_shared (*test_application, processor, *system0.nodes[0], system0.wallet (0), key1)); wallet->start (); { - rai::transaction transaction (system1.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system1.nodes[0]->store.environment, true); auto latest (system1.nodes[0]->ledger.latest (transaction, rai::genesis_account)); rai::send_block send (latest, key1, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, system1.work.generate (latest)); system1.nodes[0]->ledger.process (transaction, send); diff --git a/rai/rai_node/entry.cpp b/rai/rai_node/entry.cpp index f6a465a8..2fe9a4e5 100644 --- a/rai/rai_node/entry.cpp +++ b/rai/rai_node/entry.cpp @@ -59,7 +59,7 @@ int main (int argc, char * const * argv) else if (vm.count ("debug_block_count")) { rai::inactive_node node (data_path); - rai::transaction transaction (node.node->store.environment, nullptr, false); + rai::transaction transaction (node.node->store.environment, false); std::cout << boost::str (boost::format ("Block count: %1%\n") % node.node->store.block_count (transaction).sum ()); } else if (vm.count ("debug_bootstrap_generate")) @@ -119,7 +119,7 @@ int main (int argc, char * const * argv) else if (vm.count ("debug_dump_representatives")) { rai::inactive_node node (data_path); - rai::transaction transaction (node.node->store.environment, nullptr, false); + rai::transaction transaction (node.node->store.environment, false); rai::uint128_t total; for (auto i (node.node->store.representation_begin (transaction)), n (node.node->store.representation_end ()); i != n; ++i) { @@ -146,7 +146,7 @@ int main (int argc, char * const * argv) else if (vm.count ("debug_account_count")) { rai::inactive_node node (data_path); - rai::transaction transaction (node.node->store.environment, nullptr, false); + rai::transaction transaction (node.node->store.environment, false); std::cout << boost::str (boost::format ("Frontier count: %1%\n") % node.node->store.account_count (transaction)); } else if (vm.count ("debug_mass_activity")) diff --git a/rai/rai_wallet/entry.cpp b/rai/rai_wallet/entry.cpp index 05bdb39a..6f3de57a 100644 --- a/rai/rai_wallet/entry.cpp +++ b/rai/rai_wallet/entry.cpp @@ -236,7 +236,7 @@ int run_wallet (QApplication & application, int argc, char * const * argv, boost } if (config.account.is_zero () || !wallet->exists (config.account)) { - rai::transaction transaction (wallet->store.environment, nullptr, true); + rai::transaction transaction (wallet->store.environment, true); auto existing (wallet->store.begin (transaction)); if (existing != wallet->store.end ()) { diff --git a/rai/secure/blockstore.cpp b/rai/secure/blockstore.cpp index 92780fee..895cc0f3 100644 --- a/rai/secure/blockstore.cpp +++ b/rai/secure/blockstore.cpp @@ -426,7 +426,7 @@ meta (0) { if (!error_a) { - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); error_a |= mdb_dbi_open (transaction, "frontiers", MDB_CREATE, &frontiers) != 0; error_a |= mdb_dbi_open (transaction, "accounts", MDB_CREATE, &accounts_v0) != 0; error_a |= mdb_dbi_open (transaction, "accounts_v1", MDB_CREATE, &accounts_v1) != 0; @@ -743,7 +743,7 @@ void rai::block_store::upgrade_v10_to_v11 (MDB_txn * transaction_a) void rai::block_store::clear (MDB_dbi db_a) { - rai::transaction transaction (environment, nullptr, true); + rai::transaction transaction (environment, true); auto status (mdb_drop (transaction, db_a, 0)); assert (status == 0); } diff --git a/rai/secure/ledger.cpp b/rai/secure/ledger.cpp index 0fb25afb..1beeaecc 100644 --- a/rai/secure/ledger.cpp +++ b/rai/secure/ledger.cpp @@ -667,7 +667,7 @@ rai::block_hash rai::ledger::representative_calculated (MDB_txn * transaction_a, bool rai::ledger::block_exists (rai::block_hash const & hash_a) { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); auto result (store.block_exists (transaction, hash_a)); return result; } @@ -680,7 +680,7 @@ std::string rai::ledger::block_text (char const * hash_a) std::string rai::ledger::block_text (rai::block_hash const & hash_a) { std::string result; - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); auto block (store.block_get (transaction, hash_a)); if (block != nullptr) { @@ -847,7 +847,7 @@ rai::checksum rai::ledger::checksum (MDB_txn * transaction_a, rai::account const void rai::ledger::dump_account_chain (rai::account const & account_a) { - rai::transaction transaction (store.environment, nullptr, false); + rai::transaction transaction (store.environment, false); auto hash (latest (transaction, account_a)); while (!hash.is_zero ()) { diff --git a/rai/slow_test/node.cpp b/rai/slow_test/node.cpp index f86171a0..b39acdf9 100644 --- a/rai/slow_test/node.cpp +++ b/rai/slow_test/node.cpp @@ -10,7 +10,7 @@ TEST (system, generate_mass_activity) size_t count (20); system.generate_mass_activity (count, *system.nodes[0]); size_t accounts (0); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); for (auto i (system.nodes[0]->store.latest_begin (transaction)), n (system.nodes[0]->store.latest_end ()); i != n; ++i) { ++accounts; @@ -25,7 +25,7 @@ TEST (system, generate_mass_activity_long) size_t count (1000000000); system.generate_mass_activity (count, *system.nodes[0]); size_t accounts (0); - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[0]->store.environment, false); for (auto i (system.nodes[0]->store.latest_begin (transaction)), n (system.nodes[0]->store.latest_end ()); i != n; ++i) { ++accounts; @@ -53,7 +53,7 @@ TEST (system, receive_while_synchronizing) node1->start (); system.alarm.add (std::chrono::steady_clock::now () + std::chrono::milliseconds (200), ([&system, &key]() { auto hash (system.wallet (0)->send_sync (rai::test_genesis_key.pub, key.pub, system.nodes[0]->config.receive_minimum.number ())); - auto block (system.nodes[0]->store.block_get (rai::transaction (system.nodes[0]->store.environment, nullptr, false), hash)); + auto block (system.nodes[0]->store.block_get (rai::transaction (system.nodes[0]->store.environment, false), hash)); std::string block_text; block->serialize_json (block_text); })); @@ -79,7 +79,7 @@ TEST (ledger, deep_account_compute) rai::stat stats; rai::ledger ledger (store, stats); rai::genesis genesis; - rai::transaction transaction (store.environment, nullptr, true); + rai::transaction transaction (store.environment, true); store.initialize (transaction, genesis); rai::keypair key; auto balance (rai::genesis_amount - 1); @@ -146,7 +146,7 @@ TEST (store, load) threads.push_back (std::thread ([&system]() { for (auto i (0); i != 1000; ++i) { - rai::transaction transaction (system.nodes[0]->store.environment, nullptr, true); + rai::transaction transaction (system.nodes[0]->store.environment, true); for (auto j (0); j != 10; ++j) { rai::block_hash hash; @@ -184,7 +184,7 @@ TEST (node, fork_storm) system.nodes[i]->work_generate_blocking (*open); auto open_result (system.nodes[i]->process (*open)); ASSERT_EQ (rai::process_result::progress, open_result.code); - rai::transaction transaction (system.nodes[i]->store.environment, nullptr, false); + rai::transaction transaction (system.nodes[i]->store.environment, false); system.nodes[i]->network.republish_block (transaction, open); } } @@ -378,10 +378,10 @@ TEST (store, unchecked_load) auto block (std::make_shared (0, 0, 0, rai::test_genesis_key.prv, rai::test_genesis_key.pub, 0)); for (auto i (0); i < 1000000; ++i) { - rai::transaction transaction (node.store.environment, nullptr, true); + rai::transaction transaction (node.store.environment, true); node.store.unchecked_put (transaction, i, block); } - rai::transaction transaction (node.store.environment, nullptr, false); + rai::transaction transaction (node.store.environment, false); auto count (node.store.unchecked_count (transaction)); }