Pass transaction in to end iterator for future use. (#4761)
This commit is contained in:
parent
902bc4b01d
commit
483c6906e8
74 changed files with 211 additions and 208 deletions
|
@ -314,10 +314,10 @@ TEST (block_store, pending_iterator)
|
|||
auto store = nano::make_store (logger, nano::unique_path (), nano::dev::constants);
|
||||
ASSERT_TRUE (!store->init_error ());
|
||||
auto transaction (store->tx_begin_write ());
|
||||
ASSERT_EQ (store->pending.end (), store->pending.begin (transaction));
|
||||
ASSERT_EQ (store->pending.end (transaction), store->pending.begin (transaction));
|
||||
store->pending.put (transaction, nano::pending_key (1, 2), { 2, 3, nano::epoch::epoch_1 });
|
||||
auto current (store->pending.begin (transaction));
|
||||
ASSERT_NE (store->pending.end (), current);
|
||||
ASSERT_NE (store->pending.end (transaction), current);
|
||||
nano::pending_key key1 (current->first);
|
||||
ASSERT_EQ (nano::account (1), key1.account);
|
||||
ASSERT_EQ (nano::block_hash (2), key1.hash);
|
||||
|
@ -411,7 +411,7 @@ TEST (block_store, empty_accounts)
|
|||
ASSERT_TRUE (!store->init_error ());
|
||||
auto transaction (store->tx_begin_read ());
|
||||
auto begin (store->account.begin (transaction));
|
||||
auto end (store->account.end ());
|
||||
auto end (store->account.end (transaction));
|
||||
ASSERT_EQ (end, begin);
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,7 @@ TEST (block_store, one_account)
|
|||
store->confirmation_height.put (transaction, account, { 20, nano::block_hash (15) });
|
||||
store->account.put (transaction, account, { hash, account, hash, 42, 100, 200, nano::epoch::epoch_0 });
|
||||
auto begin (store->account.begin (transaction));
|
||||
auto end (store->account.end ());
|
||||
auto end (store->account.end (transaction));
|
||||
ASSERT_NE (end, begin);
|
||||
ASSERT_EQ (account, nano::account (begin->first));
|
||||
nano::account_info info (begin->second);
|
||||
|
@ -567,7 +567,7 @@ TEST (block_store, two_account)
|
|||
store->confirmation_height.put (transaction, account2, { 30, nano::block_hash (20) });
|
||||
store->account.put (transaction, account2, { hash2, account2, hash2, 84, 200, 400, nano::epoch::epoch_0 });
|
||||
auto begin (store->account.begin (transaction));
|
||||
auto end (store->account.end ());
|
||||
auto end (store->account.end (transaction));
|
||||
ASSERT_NE (end, begin);
|
||||
ASSERT_EQ (account1, nano::account (begin->first));
|
||||
nano::account_info info1 (begin->second);
|
||||
|
@ -787,7 +787,7 @@ TEST (block_store, large_iteration)
|
|||
std::unordered_set<nano::account> accounts2;
|
||||
nano::account previous{};
|
||||
auto transaction (store->tx_begin_read ());
|
||||
for (auto i (store->account.begin (transaction, 0)), n (store->account.end ()); i != n; ++i)
|
||||
for (auto i (store->account.begin (transaction, 0)), n (store->account.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account current (i->first);
|
||||
ASSERT_GT (current.number (), previous.number ());
|
||||
|
@ -798,7 +798,7 @@ TEST (block_store, large_iteration)
|
|||
// Reverse iteration
|
||||
std::unordered_set<nano::account> accounts3;
|
||||
previous = std::numeric_limits<nano::uint256_t>::max ();
|
||||
for (auto i (store->account.rbegin (transaction)), n (store->account.end ()); i != n; --i)
|
||||
for (auto i (store->account.rbegin (transaction)), n (store->account.end (transaction)); i != n; --i)
|
||||
{
|
||||
nano::account current (i->first);
|
||||
ASSERT_LT (current.number (), previous.number ());
|
||||
|
@ -1253,8 +1253,8 @@ TEST (block_store, online_weight)
|
|||
{
|
||||
auto transaction (store->tx_begin_write ());
|
||||
ASSERT_EQ (0, store->online_weight.count (transaction));
|
||||
ASSERT_EQ (store->online_weight.end (), store->online_weight.begin (transaction));
|
||||
ASSERT_EQ (store->online_weight.end (), store->online_weight.rbegin (transaction));
|
||||
ASSERT_EQ (store->online_weight.end (transaction), store->online_weight.begin (transaction));
|
||||
ASSERT_EQ (store->online_weight.end (transaction), store->online_weight.rbegin (transaction));
|
||||
store->online_weight.put (transaction, 1, 2);
|
||||
store->online_weight.put (transaction, 3, 4);
|
||||
}
|
||||
|
@ -1262,11 +1262,11 @@ TEST (block_store, online_weight)
|
|||
auto transaction (store->tx_begin_write ());
|
||||
ASSERT_EQ (2, store->online_weight.count (transaction));
|
||||
auto item (store->online_weight.begin (transaction));
|
||||
ASSERT_NE (store->online_weight.end (), item);
|
||||
ASSERT_NE (store->online_weight.end (transaction), item);
|
||||
ASSERT_EQ (1, item->first);
|
||||
ASSERT_EQ (2, item->second.number ());
|
||||
auto item_last (store->online_weight.rbegin (transaction));
|
||||
ASSERT_NE (store->online_weight.end (), item_last);
|
||||
ASSERT_NE (store->online_weight.end (transaction), item_last);
|
||||
ASSERT_EQ (3, item_last->first);
|
||||
ASSERT_EQ (4, item_last->second.number ());
|
||||
store->online_weight.del (transaction, 1);
|
||||
|
@ -1276,8 +1276,8 @@ TEST (block_store, online_weight)
|
|||
}
|
||||
auto transaction (store->tx_begin_read ());
|
||||
ASSERT_EQ (0, store->online_weight.count (transaction));
|
||||
ASSERT_EQ (store->online_weight.end (), store->online_weight.begin (transaction));
|
||||
ASSERT_EQ (store->online_weight.end (), store->online_weight.rbegin (transaction));
|
||||
ASSERT_EQ (store->online_weight.end (transaction), store->online_weight.begin (transaction));
|
||||
ASSERT_EQ (store->online_weight.end (transaction), store->online_weight.rbegin (transaction));
|
||||
}
|
||||
|
||||
TEST (block_store, pruned_blocks)
|
||||
|
|
|
@ -5464,7 +5464,7 @@ TEST (ledger, migrate_lmdb_to_rocksdb)
|
|||
|
||||
ASSERT_TRUE (rocksdb_store.pending.get (rocksdb_transaction, nano::pending_key (nano::dev::genesis_key.pub, send->hash ())));
|
||||
|
||||
for (auto i = rocksdb_store.online_weight.begin (rocksdb_transaction); i != rocksdb_store.online_weight.end (); ++i)
|
||||
for (auto i = rocksdb_store.online_weight.begin (rocksdb_transaction); i != rocksdb_store.online_weight.end (rocksdb_transaction); ++i)
|
||||
{
|
||||
ASSERT_EQ (i->first, 100);
|
||||
ASSERT_EQ (i->second, 2);
|
||||
|
|
|
@ -95,9 +95,9 @@ TEST (system, DISABLED_generate_send_new)
|
|||
{
|
||||
auto transaction (node1.store.tx_begin_read ());
|
||||
auto iterator1 (node1.store.account.begin (transaction));
|
||||
ASSERT_NE (node1.store.account.end (), iterator1);
|
||||
ASSERT_NE (node1.store.account.end (transaction), iterator1);
|
||||
++iterator1;
|
||||
ASSERT_EQ (node1.store.account.end (), iterator1);
|
||||
ASSERT_EQ (node1.store.account.end (transaction), iterator1);
|
||||
}
|
||||
nano::keypair stake_preserver;
|
||||
auto send_block (system.wallet (0)->send_action (nano::dev::genesis_key.pub, stake_preserver.pub, nano::dev::constants.genesis_amount / 3 * 2, true));
|
||||
|
@ -130,13 +130,13 @@ TEST (system, DISABLED_generate_send_new)
|
|||
new_account = iterator2->first;
|
||||
}
|
||||
++iterator2;
|
||||
ASSERT_NE (system.wallet (0)->store.end (), iterator2);
|
||||
ASSERT_NE (system.wallet (0)->store.end (transaction), iterator2);
|
||||
if (iterator2->first != nano::dev::genesis_key.pub)
|
||||
{
|
||||
new_account = iterator2->first;
|
||||
}
|
||||
++iterator2;
|
||||
ASSERT_EQ (system.wallet (0)->store.end (), iterator2);
|
||||
ASSERT_EQ (system.wallet (0)->store.end (transaction), iterator2);
|
||||
ASSERT_FALSE (new_account.is_zero ());
|
||||
}
|
||||
ASSERT_TIMELY (10s, node1.balance (new_account) != 0);
|
||||
|
|
|
@ -104,7 +104,7 @@ TEST (wallet, empty_iteration)
|
|||
nano::wallet_store wallet (init, kdf, transaction, env, nano::dev::genesis_key.pub, 1, "0");
|
||||
ASSERT_FALSE (init);
|
||||
auto i (wallet.begin (transaction));
|
||||
auto j (wallet.end ());
|
||||
auto j (wallet.end (transaction));
|
||||
ASSERT_EQ (i, j);
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ TEST (wallet, one_item_iteration)
|
|||
ASSERT_FALSE (init);
|
||||
nano::keypair key1;
|
||||
wallet.insert_adhoc (transaction, key1.prv);
|
||||
for (auto i (wallet.begin (transaction)), j (wallet.end ()); i != j; ++i)
|
||||
for (auto i (wallet.begin (transaction)), j (wallet.end (transaction)); i != j; ++i)
|
||||
{
|
||||
ASSERT_EQ (key1.pub, nano::uint256_union (i->first));
|
||||
nano::raw_key password;
|
||||
|
@ -147,7 +147,7 @@ TEST (wallet, two_item_iteration)
|
|||
ASSERT_FALSE (init);
|
||||
wallet.insert_adhoc (transaction, key1.prv);
|
||||
wallet.insert_adhoc (transaction, key2.prv);
|
||||
for (auto i (wallet.begin (transaction)), j (wallet.end ()); i != j; ++i)
|
||||
for (auto i (wallet.begin (transaction)), j (wallet.end (transaction)); i != j; ++i)
|
||||
{
|
||||
pubs.insert (i->first);
|
||||
nano::raw_key password;
|
||||
|
@ -266,7 +266,7 @@ TEST (wallet, find_none)
|
|||
nano::wallet_store wallet (init, kdf, transaction, env, nano::dev::genesis_key.pub, 1, "0");
|
||||
ASSERT_FALSE (init);
|
||||
nano::account account (1000);
|
||||
ASSERT_EQ (wallet.end (), wallet.find (transaction, account));
|
||||
ASSERT_EQ (wallet.end (transaction), wallet.find (transaction, account));
|
||||
}
|
||||
|
||||
TEST (wallet, find_existing)
|
||||
|
@ -283,9 +283,9 @@ TEST (wallet, find_existing)
|
|||
wallet.insert_adhoc (transaction, key1.prv);
|
||||
ASSERT_TRUE (wallet.exists (transaction, key1.pub));
|
||||
auto existing (wallet.find (transaction, key1.pub));
|
||||
ASSERT_NE (wallet.end (), existing);
|
||||
ASSERT_NE (wallet.end (transaction), existing);
|
||||
++existing;
|
||||
ASSERT_EQ (wallet.end (), existing);
|
||||
ASSERT_EQ (wallet.end (transaction), existing);
|
||||
}
|
||||
|
||||
TEST (wallet, rekey)
|
||||
|
@ -487,8 +487,8 @@ TEST (wallet, serialize_json_empty)
|
|||
ASSERT_EQ (wallet1.salt (transaction), wallet2.salt (transaction));
|
||||
ASSERT_EQ (wallet1.check (transaction), wallet2.check (transaction));
|
||||
ASSERT_EQ (wallet1.representative (transaction), wallet2.representative (transaction));
|
||||
ASSERT_EQ (wallet1.end (), wallet1.begin (transaction));
|
||||
ASSERT_EQ (wallet2.end (), wallet2.begin (transaction));
|
||||
ASSERT_EQ (wallet1.end (transaction), wallet1.begin (transaction));
|
||||
ASSERT_EQ (wallet2.end (transaction), wallet2.begin (transaction));
|
||||
}
|
||||
|
||||
TEST (wallet, serialize_json_one)
|
||||
|
|
|
@ -353,7 +353,7 @@ int main (int argc, char * const * argv)
|
|||
auto inactive_node = nano::default_inactive_node (data_path, vm);
|
||||
auto transaction = inactive_node->node->store.tx_begin_read ();
|
||||
auto i = inactive_node->node->store.block.begin (transaction);
|
||||
auto end = inactive_node->node->store.block.end ();
|
||||
auto end = inactive_node->node->store.block.end (transaction);
|
||||
for (; i != end; ++i)
|
||||
{
|
||||
nano::block_hash hash = i->first;
|
||||
|
@ -435,7 +435,7 @@ int main (int argc, char * const * argv)
|
|||
auto current (node->online_reps.trended ());
|
||||
std::cout << boost::str (boost::format ("Trended Weight %1%\n") % current);
|
||||
auto transaction (node->store.tx_begin_read ());
|
||||
for (auto i (node->store.online_weight.begin (transaction)), n (node->store.online_weight.end ()); i != n; ++i)
|
||||
for (auto i (node->store.online_weight.begin (transaction)), n (node->store.online_weight.end (transaction)); i != n; ++i)
|
||||
{
|
||||
using time_point = std::chrono::system_clock::time_point;
|
||||
time_point ts (std::chrono::duration_cast<time_point::duration> (std::chrono::nanoseconds (i->first)));
|
||||
|
@ -471,7 +471,7 @@ int main (int argc, char * const * argv)
|
|||
// Cache the account heads to make searching quicker against unchecked keys.
|
||||
auto transaction (node->store.tx_begin_read ());
|
||||
std::unordered_set<nano::block_hash> frontier_hashes;
|
||||
for (auto i (node->store.account.begin (transaction)), n (node->store.account.end ()); i != n; ++i)
|
||||
for (auto i (node->store.account.begin (transaction)), n (node->store.account.end (transaction)); i != n; ++i)
|
||||
{
|
||||
frontier_hashes.insert (i->second.head);
|
||||
}
|
||||
|
@ -1669,7 +1669,7 @@ int main (int argc, char * const * argv)
|
|||
}
|
||||
size_t const accounts_deque_overflow (32 * 1024);
|
||||
auto transaction = node->ledger.tx_begin_read ();
|
||||
for (auto i (node->store.account.begin (transaction)), n (node->store.account.end ()); i != n; ++i)
|
||||
for (auto i (node->store.account.begin (transaction)), n (node->store.account.end (transaction)); i != n; ++i)
|
||||
{
|
||||
{
|
||||
nano::unique_lock<nano::mutex> lock{ mutex };
|
||||
|
@ -1780,7 +1780,7 @@ int main (int argc, char * const * argv)
|
|||
start_threads (check_pending, pending);
|
||||
|
||||
size_t const pending_deque_overflow (64 * 1024);
|
||||
for (auto i (node->store.pending.begin (transaction)), n (node->store.pending.end ()); i != n; ++i)
|
||||
for (auto i (node->store.pending.begin (transaction)), n (node->store.pending.end (transaction)); i != n; ++i)
|
||||
{
|
||||
{
|
||||
nano::unique_lock<nano::mutex> lock{ mutex };
|
||||
|
@ -1837,7 +1837,7 @@ int main (int argc, char * const * argv)
|
|||
auto transaction = source_node->ledger.tx_begin_read ();
|
||||
block_count = source_node->ledger.block_count ();
|
||||
std::cout << boost::str (boost::format ("Performing bootstrap emulation, %1% blocks in ledger...") % block_count) << std::endl;
|
||||
for (auto i (source_node->store.account.begin (transaction)), n (source_node->store.account.end ()); i != n; ++i)
|
||||
for (auto i (source_node->store.account.begin (transaction)), n (source_node->store.account.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
nano::account_info const & info (i->second);
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
{
|
||||
auto transaction (wallet->wallets.tx_begin_write ());
|
||||
auto existing (wallet->store.begin (transaction));
|
||||
if (existing != wallet->store.end ())
|
||||
if (existing != wallet->store.end (transaction))
|
||||
{
|
||||
wallet_config.account = existing->first;
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ void nano::backlog_population::populate_backlog (nano::unique_lock<nano::mutex>
|
|||
auto transaction = ledger.tx_begin_read ();
|
||||
|
||||
auto it = ledger.store.account.begin (transaction, next);
|
||||
auto const end = ledger.store.account.end ();
|
||||
auto const end = ledger.store.account.end (transaction);
|
||||
|
||||
auto should_refresh = [&transaction] () {
|
||||
auto cutoff = std::chrono::steady_clock::now () - 100ms; // TODO: Make this configurable
|
||||
|
|
|
@ -239,7 +239,7 @@ void nano::frontier_req_client::next ()
|
|||
{
|
||||
std::size_t max_size (128);
|
||||
auto transaction (node->store.tx_begin_read ());
|
||||
for (auto i (node->store.account.begin (transaction, current.number () + 1)), n (node->store.account.end ()); i != n && accounts.size () != max_size; ++i)
|
||||
for (auto i (node->store.account.begin (transaction, current.number () + 1)), n (node->store.account.end (transaction)); i != n && accounts.size () != max_size; ++i)
|
||||
{
|
||||
nano::account_info const & info (i->second);
|
||||
nano::account const & account (i->first);
|
||||
|
@ -381,7 +381,7 @@ void nano::frontier_req_server::next ()
|
|||
auto transaction (node->store.tx_begin_read ());
|
||||
if (!send_confirmed ())
|
||||
{
|
||||
for (auto i (node->store.account.begin (transaction, current.number () + 1)), n (node->store.account.end ()); i != n && accounts.size () != max_size; ++i)
|
||||
for (auto i (node->store.account.begin (transaction, current.number () + 1)), n (node->store.account.end (transaction)); i != n && accounts.size () != max_size; ++i)
|
||||
{
|
||||
nano::account_info const & info (i->second);
|
||||
if (disable_age_filter || (now - info.modified) <= request->age)
|
||||
|
@ -393,7 +393,7 @@ void nano::frontier_req_server::next ()
|
|||
}
|
||||
else
|
||||
{
|
||||
for (auto i (node->store.confirmation_height.begin (transaction, current.number () + 1)), n (node->store.confirmation_height.end ()); i != n && accounts.size () != max_size; ++i)
|
||||
for (auto i (node->store.confirmation_height.begin (transaction, current.number () + 1)), n (node->store.confirmation_height.end (transaction)); i != n && accounts.size () != max_size; ++i)
|
||||
{
|
||||
nano::confirmation_height_info const & info (i->second);
|
||||
nano::block_hash const & confirmed_frontier (info.frontier);
|
||||
|
|
|
@ -395,7 +395,7 @@ nano::asc_pull_ack nano::bootstrap_server::process (secure::transaction const &
|
|||
response.type = nano::asc_pull_type::frontiers;
|
||||
|
||||
nano::asc_pull_ack::frontiers_payload response_payload{};
|
||||
for (auto it = store.account.begin (transaction, request.start), end = store.account.end (); it != end && response_payload.frontiers.size () < request.count; ++it)
|
||||
for (auto it = store.account.begin (transaction, request.start), end = store.account.end (transaction); it != end && response_payload.frontiers.size () < request.count; ++it)
|
||||
{
|
||||
response_payload.frontiers.emplace_back (it->first, it->second.head);
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ std::deque<nano::account> nano::bootstrap_ascending::account_database_iterator::
|
|||
std::deque<nano::account> result;
|
||||
|
||||
auto it = ledger.store.account.begin (transaction, next);
|
||||
auto const end = ledger.store.account.end ();
|
||||
auto const end = ledger.store.account.end (transaction);
|
||||
|
||||
for (size_t count = 0; it != end && count < batch_size; ++it, ++count)
|
||||
{
|
||||
|
@ -115,7 +115,7 @@ std::deque<nano::account> nano::bootstrap_ascending::pending_database_iterator::
|
|||
std::deque<nano::account> result;
|
||||
|
||||
auto it = ledger.store.pending.begin (transaction, next);
|
||||
auto const end = ledger.store.pending.end ();
|
||||
auto const end = ledger.store.pending.end (transaction);
|
||||
|
||||
// TODO: This pending iteration heuristic should be encapsulated in a pending_iterator class and reused across other components
|
||||
// The heuristic is to advance the iterator sequentially until we reach a new account or perform a fresh lookup if the account has too many pending blocks
|
||||
|
@ -164,4 +164,4 @@ std::deque<nano::account> nano::bootstrap_ascending::pending_database_iterator::
|
|||
bool nano::bootstrap_ascending::pending_database_iterator::warmed_up () const
|
||||
{
|
||||
return completed > 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1012,7 +1012,7 @@ std::error_code nano::handle_node_options (boost::program_options::variables_map
|
|||
nano::raw_key seed;
|
||||
existing->second->store.seed (seed, transaction);
|
||||
std::cout << boost::str (boost::format ("Seed: %1%\n") % seed.to_string ());
|
||||
for (auto i (existing->second->store.begin (transaction)), m (existing->second->store.end ()); i != m; ++i)
|
||||
for (auto i (existing->second->store.begin (transaction)), m (existing->second->store.end (transaction)); i != m; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
nano::raw_key key;
|
||||
|
@ -1201,7 +1201,7 @@ std::error_code nano::handle_node_options (boost::program_options::variables_map
|
|||
{
|
||||
std::cout << boost::str (boost::format ("Wallet ID: %1%\n") % i->first.to_string ());
|
||||
auto transaction (i->second->wallets.tx_begin_read ());
|
||||
for (auto j (i->second->store.begin (transaction)), m (i->second->store.end ()); j != m; ++j)
|
||||
for (auto j (i->second->store.begin (transaction)), m (i->second->store.end (transaction)); j != m; ++j)
|
||||
{
|
||||
std::cout << nano::account (j->first).to_account () << '\n';
|
||||
}
|
||||
|
@ -1224,7 +1224,7 @@ std::error_code nano::handle_node_options (boost::program_options::variables_map
|
|||
{
|
||||
auto transaction (wallet->second->wallets.tx_begin_write ());
|
||||
auto account (wallet->second->store.find (transaction, account_id));
|
||||
if (account != wallet->second->store.end ())
|
||||
if (account != wallet->second->store.end (transaction))
|
||||
{
|
||||
wallet->second->store.erase (transaction, account_id);
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ void nano::epoch_upgrader::upgrade_impl (nano::raw_key const & prv_a, nano::epoc
|
|||
{
|
||||
auto transaction (store.tx_begin_read ());
|
||||
// Collect accounts to upgrade
|
||||
for (auto i (store.account.begin (transaction)), n (store.account.end ()); i != n && accounts_list.size () < count_limit; ++i)
|
||||
for (auto i (store.account.begin (transaction)), n (store.account.end (transaction)); i != n && accounts_list.size () < count_limit; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
nano::account_info const & info (i->second);
|
||||
|
|
|
@ -207,7 +207,7 @@ bool nano::json_handler::wallet_account_impl (store::transaction const & transac
|
|||
bool result (false);
|
||||
if (!ec)
|
||||
{
|
||||
if (wallet_a->store.find (transaction_a, account_a) != wallet_a->store.end ())
|
||||
if (wallet_a->store.find (transaction_a, account_a) != wallet_a->store.end (transaction_a))
|
||||
{
|
||||
result = true;
|
||||
}
|
||||
|
@ -718,7 +718,7 @@ void nano::json_handler::account_list ()
|
|||
{
|
||||
boost::property_tree::ptree accounts;
|
||||
auto transaction (node.wallets.tx_begin_read ());
|
||||
for (auto i (wallet->store.begin (transaction)), j (wallet->store.end ()); i != j; ++i)
|
||||
for (auto i (wallet->store.begin (transaction)), j (wallet->store.end (transaction)); i != j; ++i)
|
||||
{
|
||||
boost::property_tree::ptree entry;
|
||||
entry.put ("", nano::account (i->first).to_account ());
|
||||
|
@ -1030,7 +1030,7 @@ void nano::json_handler::accounts_receivable ()
|
|||
if (!ec)
|
||||
{
|
||||
boost::property_tree::ptree peers_l;
|
||||
for (auto i (node.store.pending.begin (transaction, nano::pending_key (account, 0))), n (node.store.pending.end ()); i != n && nano::pending_key (i->first).account == account && peers_l.size () < count; ++i)
|
||||
for (auto i (node.store.pending.begin (transaction, nano::pending_key (account, 0))), n (node.store.pending.end (transaction)); i != n && nano::pending_key (i->first).account == account && peers_l.size () < count; ++i)
|
||||
{
|
||||
nano::pending_key const & key (i->first);
|
||||
if (block_confirmed (node, transaction, key.hash, include_active, include_only_confirmed))
|
||||
|
@ -2240,7 +2240,7 @@ void nano::json_handler::delegators ()
|
|||
{
|
||||
auto transaction (node.ledger.tx_begin_read ());
|
||||
boost::property_tree::ptree delegators;
|
||||
for (auto i (node.store.account.begin (transaction, start_account.number () + 1)), n (node.store.account.end ()); i != n && delegators.size () < count; ++i)
|
||||
for (auto i (node.store.account.begin (transaction, start_account.number () + 1)), n (node.store.account.end (transaction)); i != n && delegators.size () < count; ++i)
|
||||
{
|
||||
nano::account_info const & info (i->second);
|
||||
if (info.representative == representative)
|
||||
|
@ -2266,7 +2266,7 @@ void nano::json_handler::delegators_count ()
|
|||
{
|
||||
uint64_t count (0);
|
||||
auto transaction (node.ledger.tx_begin_read ());
|
||||
for (auto i (node.store.account.begin (transaction)), n (node.store.account.end ()); i != n; ++i)
|
||||
for (auto i (node.store.account.begin (transaction)), n (node.store.account.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account_info const & info (i->second);
|
||||
if (info.representative == account)
|
||||
|
@ -2377,7 +2377,7 @@ void nano::json_handler::frontiers ()
|
|||
{
|
||||
boost::property_tree::ptree frontiers;
|
||||
auto transaction (node.ledger.tx_begin_read ());
|
||||
for (auto i (node.store.account.begin (transaction, start)), n (node.store.account.end ()); i != n && frontiers.size () < count; ++i)
|
||||
for (auto i (node.store.account.begin (transaction, start)), n (node.store.account.end (transaction)); i != n && frontiers.size () < count; ++i)
|
||||
{
|
||||
frontiers.put (i->first.to_account (), i->second.head.to_string ());
|
||||
}
|
||||
|
@ -2780,7 +2780,7 @@ void nano::json_handler::ledger ()
|
|||
auto transaction = node.ledger.tx_begin_read ();
|
||||
if (!ec && !sorting) // Simple
|
||||
{
|
||||
for (auto i (node.store.account.begin (transaction, start)), n (node.store.account.end ()); i != n && accounts.size () < count; ++i)
|
||||
for (auto i (node.store.account.begin (transaction, start)), n (node.store.account.end (transaction)); i != n && accounts.size () < count; ++i)
|
||||
{
|
||||
nano::account_info const & info (i->second);
|
||||
if (info.modified >= modified_since && (receivable || info.balance.number () >= threshold.number ()))
|
||||
|
@ -2821,7 +2821,7 @@ void nano::json_handler::ledger ()
|
|||
else if (!ec) // Sorting
|
||||
{
|
||||
std::vector<std::pair<nano::uint128_union, nano::account>> ledger_l;
|
||||
for (auto i (node.store.account.begin (transaction, start)), n (node.store.account.end ()); i != n; ++i)
|
||||
for (auto i (node.store.account.begin (transaction, start)), n (node.store.account.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account_info const & info (i->second);
|
||||
nano::uint128_union balance (info.balance);
|
||||
|
@ -3055,7 +3055,7 @@ void nano::json_handler::receivable ()
|
|||
// The ptree container is used if there are any children nodes (e.g source/min_version) otherwise the amount container is used.
|
||||
std::vector<std::pair<std::string, boost::property_tree::ptree>> hash_ptree_pairs;
|
||||
std::vector<std::pair<std::string, nano::uint128_t>> hash_amount_pairs;
|
||||
for (auto i (node.store.pending.begin (transaction, nano::pending_key (account, 0))), n (node.store.pending.end ()); i != n && nano::pending_key (i->first).account == account && (should_sort || peers_l.size () < count); ++i)
|
||||
for (auto i (node.store.pending.begin (transaction, nano::pending_key (account, 0))), n (node.store.pending.end (transaction)); i != n && nano::pending_key (i->first).account == account && (should_sort || peers_l.size () < count); ++i)
|
||||
{
|
||||
nano::pending_key const & key (i->first);
|
||||
if (block_confirmed (node, transaction, key.hash, include_active, include_only_confirmed))
|
||||
|
@ -4240,7 +4240,7 @@ void nano::json_handler::unopened ()
|
|||
{
|
||||
auto transaction = node.store.tx_begin_read ();
|
||||
auto iterator = node.store.pending.begin (transaction, nano::pending_key (start, 0));
|
||||
auto end = node.store.pending.end ();
|
||||
auto end = node.store.pending.end (transaction);
|
||||
nano::account current_account = start;
|
||||
nano::uint128_t current_account_sum{ 0 };
|
||||
boost::property_tree::ptree accounts;
|
||||
|
@ -4392,7 +4392,7 @@ void nano::json_handler::wallet_info ()
|
|||
uint64_t adhoc_count (0);
|
||||
auto transaction (node.wallets.tx_begin_read ());
|
||||
auto block_transaction = node.ledger.tx_begin_read ();
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i)
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
|
||||
|
@ -4448,7 +4448,7 @@ void nano::json_handler::wallet_balances ()
|
|||
boost::property_tree::ptree balances;
|
||||
auto transaction (node.wallets.tx_begin_read ());
|
||||
auto block_transaction = node.ledger.tx_begin_read ();
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i)
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
nano::uint128_t balance = node.ledger.any.account_balance (block_transaction, account).value_or (0).number ();
|
||||
|
@ -4509,7 +4509,7 @@ void nano::json_handler::wallet_contains ()
|
|||
if (!ec)
|
||||
{
|
||||
auto transaction (node.wallets.tx_begin_read ());
|
||||
auto exists (wallet->store.find (transaction, account) != wallet->store.end ());
|
||||
auto exists (wallet->store.find (transaction, account) != wallet->store.end (transaction));
|
||||
response_l.put ("exists", exists ? "1" : "0");
|
||||
}
|
||||
response_errors ();
|
||||
|
@ -4599,7 +4599,7 @@ void nano::json_handler::wallet_frontiers ()
|
|||
boost::property_tree::ptree frontiers;
|
||||
auto transaction (node.wallets.tx_begin_read ());
|
||||
auto block_transaction = node.ledger.tx_begin_read ();
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i)
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
auto latest (node.ledger.any.account_head (block_transaction, account));
|
||||
|
@ -4630,7 +4630,7 @@ void nano::json_handler::wallet_history ()
|
|||
std::multimap<uint64_t, boost::property_tree::ptree, std::greater<uint64_t>> entries;
|
||||
auto transaction (node.wallets.tx_begin_read ());
|
||||
auto block_transaction = node.ledger.tx_begin_read ();
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i)
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
auto info = node.ledger.any.account_get (block_transaction, account);
|
||||
|
@ -4704,7 +4704,7 @@ void nano::json_handler::wallet_ledger ()
|
|||
boost::property_tree::ptree accounts;
|
||||
auto transaction (node.wallets.tx_begin_read ());
|
||||
auto block_transaction = node.ledger.tx_begin_read ();
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i)
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
auto info = node.ledger.any.account_get (block_transaction, account);
|
||||
|
@ -4780,11 +4780,11 @@ void nano::json_handler::wallet_receivable ()
|
|||
boost::property_tree::ptree pending;
|
||||
auto transaction (node.wallets.tx_begin_read ());
|
||||
auto block_transaction = node.ledger.tx_begin_read ();
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i)
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
boost::property_tree::ptree peers_l;
|
||||
for (auto ii (node.store.pending.begin (block_transaction, nano::pending_key (account, 0))), nn (node.store.pending.end ()); ii != nn && nano::pending_key (ii->first).account == account && peers_l.size () < count; ++ii)
|
||||
for (auto ii (node.store.pending.begin (block_transaction, nano::pending_key (account, 0))), nn (node.store.pending.end (block_transaction)); ii != nn && nano::pending_key (ii->first).account == account && peers_l.size () < count; ++ii)
|
||||
{
|
||||
nano::pending_key key (ii->first);
|
||||
if (block_confirmed (node, block_transaction, key.hash, include_active, include_only_confirmed))
|
||||
|
@ -4871,7 +4871,7 @@ void nano::json_handler::wallet_representative_set ()
|
|||
{
|
||||
auto transaction (rpc_l->node.wallets.tx_begin_read ());
|
||||
auto block_transaction = rpc_l->node.ledger.tx_begin_read ();
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i)
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
auto info = rpc_l->node.ledger.any.account_get (block_transaction, account);
|
||||
|
@ -4905,7 +4905,7 @@ void nano::json_handler::wallet_republish ()
|
|||
std::deque<std::shared_ptr<nano::block>> republish_bundle;
|
||||
auto transaction (node.wallets.tx_begin_read ());
|
||||
auto block_transaction = node.ledger.tx_begin_read ();
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i)
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
auto latest (node.ledger.any.account_head (block_transaction, account));
|
||||
|
@ -4967,7 +4967,7 @@ void nano::json_handler::wallet_work_get ()
|
|||
{
|
||||
boost::property_tree::ptree works;
|
||||
auto transaction (node.wallets.tx_begin_read ());
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end ()); i != n; ++i)
|
||||
for (auto i (wallet->store.begin (transaction)), n (wallet->store.end (transaction)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
uint64_t work (0);
|
||||
|
|
|
@ -311,7 +311,7 @@ nano::node::node (std::shared_ptr<boost::asio::io_context> io_ctx_a, std::filesy
|
|||
auto is_initialized (false);
|
||||
{
|
||||
auto const transaction (store.tx_begin_read ());
|
||||
is_initialized = (store.account.begin (transaction) != store.account.end ());
|
||||
is_initialized = (store.account.begin (transaction) != store.account.end (transaction));
|
||||
}
|
||||
|
||||
if (!is_initialized && !flags.read_only)
|
||||
|
@ -754,7 +754,7 @@ void nano::node::long_inactivity_cleanup ()
|
|||
if (store.online_weight.count (transaction) > 0)
|
||||
{
|
||||
auto sample (store.online_weight.rbegin (transaction));
|
||||
auto n (store.online_weight.end ());
|
||||
auto n (store.online_weight.end (transaction));
|
||||
debug_assert (sample != n);
|
||||
auto const one_week_ago = static_cast<std::size_t> ((std::chrono::system_clock::now () - std::chrono::hours (7 * 24)).time_since_epoch ().count ());
|
||||
perform_cleanup = sample->first < one_week_ago;
|
||||
|
@ -803,7 +803,7 @@ void nano::node::ongoing_bootstrap ()
|
|||
{
|
||||
auto transaction = store.tx_begin_read ();
|
||||
auto last_record = store.online_weight.rbegin (transaction);
|
||||
if (last_record != store.online_weight.end ())
|
||||
if (last_record != store.online_weight.end (transaction))
|
||||
{
|
||||
last_sample_time = last_record->first;
|
||||
}
|
||||
|
@ -870,7 +870,7 @@ void nano::node::bootstrap_wallet ()
|
|||
{
|
||||
auto & wallet (*i->second);
|
||||
nano::lock_guard<std::recursive_mutex> wallet_lock{ wallet.store.mutex };
|
||||
for (auto j (wallet.store.begin (transaction)), m (wallet.store.end ()); j != m && accounts.size () < 128; ++j)
|
||||
for (auto j (wallet.store.begin (transaction)), m (wallet.store.end (transaction)); j != m && accounts.size () < 128; ++j)
|
||||
{
|
||||
nano::account account (j->first);
|
||||
accounts.push_back (account);
|
||||
|
@ -888,7 +888,7 @@ bool nano::node::collect_ledger_pruning_targets (std::deque<nano::block_hash> &
|
|||
uint64_t read_operations (0);
|
||||
bool finish_transaction (false);
|
||||
auto transaction = ledger.tx_begin_read ();
|
||||
for (auto i (store.confirmation_height.begin (transaction, last_account_a)), n (store.confirmation_height.end ()); i != n && !finish_transaction;)
|
||||
for (auto i (store.confirmation_height.begin (transaction, last_account_a)), n (store.confirmation_height.end (transaction)); i != n && !finish_transaction;)
|
||||
{
|
||||
++read_operations;
|
||||
auto const & account (i->first);
|
||||
|
|
|
@ -45,7 +45,7 @@ void nano::online_reps::sample ()
|
|||
while (ledger.store.online_weight.count (transaction) >= config.network_params.node.max_weight_samples)
|
||||
{
|
||||
auto oldest (ledger.store.online_weight.begin (transaction));
|
||||
debug_assert (oldest != ledger.store.online_weight.end ());
|
||||
debug_assert (oldest != ledger.store.online_weight.end (transaction));
|
||||
ledger.store.online_weight.del (transaction, oldest->first);
|
||||
}
|
||||
ledger.store.online_weight.put (transaction, std::chrono::system_clock::now ().time_since_epoch ().count (), online_l);
|
||||
|
@ -70,7 +70,7 @@ nano::uint128_t nano::online_reps::calculate_trend (store::transaction & transac
|
|||
std::vector<nano::uint128_t> items;
|
||||
items.reserve (config.network_params.node.max_weight_samples + 1);
|
||||
items.push_back (config.online_weight_minimum.number ());
|
||||
for (auto i (ledger.store.online_weight.begin (transaction_a)), n (ledger.store.online_weight.end ()); i != n; ++i)
|
||||
for (auto i (ledger.store.online_weight.begin (transaction_a)), n (ledger.store.online_weight.end (transaction_a)); i != n; ++i)
|
||||
{
|
||||
items.push_back (i->second.number ());
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ void nano::peer_history::run_one ()
|
|||
auto const now = std::chrono::system_clock::now ();
|
||||
auto const cutoff = now - config.erase_cutoff;
|
||||
|
||||
for (auto it = store.peer.begin (transaction); it != store.peer.end (); ++it)
|
||||
for (auto it = store.peer.begin (transaction); it != store.peer.end (transaction); ++it)
|
||||
{
|
||||
auto const [endpoint, timestamp_millis] = *it;
|
||||
auto timestamp = nano::from_milliseconds_since_epoch (timestamp_millis);
|
||||
|
@ -124,7 +124,7 @@ std::vector<nano::endpoint> nano::peer_history::peers () const
|
|||
{
|
||||
auto transaction = store.tx_begin_read ();
|
||||
std::vector<nano::endpoint> peers;
|
||||
for (auto it = store.peer.begin (transaction); it != store.peer.end (); ++it)
|
||||
for (auto it = store.peer.begin (transaction); it != store.peer.end (transaction); ++it)
|
||||
{
|
||||
auto const [endpoint, timestamp_millis] = *it;
|
||||
peers.push_back (endpoint.endpoint ());
|
||||
|
|
|
@ -114,7 +114,7 @@ void nano::wallet_store::deterministic_index_set (store::transaction const & tra
|
|||
void nano::wallet_store::deterministic_clear (store::transaction const & transaction_a)
|
||||
{
|
||||
nano::uint256_union key (0);
|
||||
for (auto i (begin (transaction_a)), n (end ()); i != n;)
|
||||
for (auto i (begin (transaction_a)), n (end (transaction_a)); i != n;)
|
||||
{
|
||||
switch (key_type (nano::wallet_value (i->second)))
|
||||
{
|
||||
|
@ -370,7 +370,7 @@ nano::wallet_store::wallet_store (bool & init_a, nano::kdf & kdf_a, store::trans
|
|||
std::vector<nano::account> nano::wallet_store::accounts (store::transaction const & transaction_a)
|
||||
{
|
||||
std::vector<nano::account> result;
|
||||
for (auto i (begin (transaction_a)), n (end ()); i != n; ++i)
|
||||
for (auto i (begin (transaction_a)), n (end (transaction_a)); i != n; ++i)
|
||||
{
|
||||
nano::account const & account (i->first);
|
||||
result.push_back (account);
|
||||
|
@ -542,7 +542,7 @@ bool nano::wallet_store::valid_public_key (nano::public_key const & pub)
|
|||
|
||||
bool nano::wallet_store::exists (store::transaction const & transaction_a, nano::public_key const & pub)
|
||||
{
|
||||
return valid_public_key (pub) && find (transaction_a, pub) != end ();
|
||||
return valid_public_key (pub) && find (transaction_a, pub) != end (transaction_a);
|
||||
}
|
||||
|
||||
void nano::wallet_store::serialize_json (store::transaction const & transaction_a, std::string & string_a)
|
||||
|
@ -597,7 +597,7 @@ bool nano::wallet_store::import (store::transaction const & transaction_a, nano:
|
|||
debug_assert (valid_password (transaction_a));
|
||||
debug_assert (other_a.valid_password (transaction_a));
|
||||
auto result (false);
|
||||
for (auto i (other_a.begin (transaction_a)), n (end ()); i != n; ++i)
|
||||
for (auto i (other_a.begin (transaction_a)), n (end (transaction_a)); i != n; ++i)
|
||||
{
|
||||
nano::raw_key prv;
|
||||
auto error (other_a.fetch (transaction_a, i->first, prv));
|
||||
|
@ -910,7 +910,7 @@ std::shared_ptr<nano::block> nano::wallet::change_action (nano::account const &
|
|||
if (store.valid_password (transaction))
|
||||
{
|
||||
auto existing (store.find (transaction, source_a));
|
||||
if (existing != store.end () && !wallets.node.ledger.any.account_head (block_transaction, source_a).is_zero ())
|
||||
if (existing != store.end (transaction) && !wallets.node.ledger.any.account_head (block_transaction, source_a).is_zero ())
|
||||
{
|
||||
auto info = wallets.node.ledger.any.account_get (block_transaction, source_a);
|
||||
debug_assert (info);
|
||||
|
@ -977,7 +977,7 @@ std::shared_ptr<nano::block> nano::wallet::send_action (nano::account const & so
|
|||
if (store.valid_password (transaction))
|
||||
{
|
||||
auto existing (store.find (transaction, source_a));
|
||||
if (existing != store.end ())
|
||||
if (existing != store.end (transaction))
|
||||
{
|
||||
auto balance (wallets.node.ledger.any.account_balance (block_transaction, source_a));
|
||||
if (balance && balance.value ().number () >= amount_a)
|
||||
|
@ -1178,14 +1178,14 @@ bool nano::wallet::search_receivable (store::transaction const & wallet_transact
|
|||
{
|
||||
wallets.node.logger.info (nano::log::type::wallet, "Beginning receivable block search");
|
||||
|
||||
for (auto i (store.begin (wallet_transaction_a)), n (store.end ()); i != n; ++i)
|
||||
for (auto i (store.begin (wallet_transaction_a)), n (store.end (wallet_transaction_a)); i != n; ++i)
|
||||
{
|
||||
auto block_transaction = wallets.node.ledger.tx_begin_read ();
|
||||
nano::account const & account (i->first);
|
||||
// Don't search pending for watch-only accounts
|
||||
if (!nano::wallet_value (i->second).key.is_zero ())
|
||||
{
|
||||
for (auto j (wallets.node.store.pending.begin (block_transaction, nano::pending_key (account, 0))), k (wallets.node.store.pending.end ()); j != k && nano::pending_key (j->first).account == account; ++j)
|
||||
for (auto j (wallets.node.store.pending.begin (block_transaction, nano::pending_key (account, 0))), k (wallets.node.store.pending.end (block_transaction)); j != k && nano::pending_key (j->first).account == account; ++j)
|
||||
{
|
||||
nano::pending_key key (j->first);
|
||||
auto hash (key.hash);
|
||||
|
@ -1227,7 +1227,7 @@ bool nano::wallet::search_receivable (store::transaction const & wallet_transact
|
|||
void nano::wallet::init_free_accounts (store::transaction const & transaction_a)
|
||||
{
|
||||
free_accounts.clear ();
|
||||
for (auto i (store.begin (transaction_a)), n (store.end ()); i != n; ++i)
|
||||
for (auto i (store.begin (transaction_a)), n (store.end (transaction_a)); i != n; ++i)
|
||||
{
|
||||
free_accounts.insert (i->first);
|
||||
}
|
||||
|
@ -1686,7 +1686,7 @@ void nano::wallets::compute_reps ()
|
|||
{
|
||||
auto & wallet (*i->second);
|
||||
decltype (wallet.representatives) representatives_l;
|
||||
for (auto ii (wallet.store.begin (transaction)), nn (wallet.store.end ()); ii != nn; ++ii)
|
||||
for (auto ii (wallet.store.begin (transaction)), nn (wallet.store.end (transaction)); ii != nn; ++ii)
|
||||
{
|
||||
auto account (ii->first);
|
||||
if (check_rep (account, half_principal_weight, false))
|
||||
|
@ -1787,7 +1787,7 @@ auto nano::wallet_store::find (store::transaction const & transaction_a, nano::a
|
|||
return result;
|
||||
}
|
||||
|
||||
auto nano::wallet_store::end () -> iterator
|
||||
auto nano::wallet_store::end (store::transaction const & transaction_a) -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
iterator find (store::transaction const &, nano::account const &);
|
||||
iterator begin (store::transaction const &, nano::account const &);
|
||||
iterator begin (store::transaction const &);
|
||||
iterator end ();
|
||||
iterator end (store::transaction const &);
|
||||
void derive_key (nano::raw_key &, store::transaction const &, std::string const &);
|
||||
void serialize_json (store::transaction const &, std::string &);
|
||||
void write_backup (store::transaction const &, std::filesystem::path const &);
|
||||
|
|
|
@ -268,7 +268,7 @@ void nano_qt::accounts::refresh_wallet_balance ()
|
|||
auto block_transaction = this->wallet.node.ledger.tx_begin_read ();
|
||||
nano::uint128_t balance (0);
|
||||
nano::uint128_t pending (0);
|
||||
for (auto i (this->wallet.wallet_m->store.begin (transaction)), j (this->wallet.wallet_m->store.end ()); i != j; ++i)
|
||||
for (auto i (this->wallet.wallet_m->store.begin (transaction)), j (this->wallet.wallet_m->store.end (transaction)); i != j; ++i)
|
||||
{
|
||||
nano::public_key const & key (i->first);
|
||||
balance = balance + this->wallet.node.ledger.any.account_balance (block_transaction, key).value_or (0).number ();
|
||||
|
@ -293,7 +293,7 @@ void nano_qt::accounts::refresh ()
|
|||
auto transaction (wallet.wallet_m->wallets.tx_begin_read ());
|
||||
auto block_transaction = this->wallet.node.ledger.tx_begin_read ();
|
||||
QBrush brush;
|
||||
for (auto i (wallet.wallet_m->store.begin (transaction)), j (wallet.wallet_m->store.end ()); i != j; ++i)
|
||||
for (auto i (wallet.wallet_m->store.begin (transaction)), j (wallet.wallet_m->store.end (transaction)); i != j; ++i)
|
||||
{
|
||||
nano::public_key key (i->first);
|
||||
auto balance_amount = wallet.node.ledger.any.account_balance (block_transaction, key).value_or (0).number ();
|
||||
|
@ -1973,7 +1973,7 @@ void nano_qt::advanced_actions::refresh_ledger ()
|
|||
{
|
||||
ledger_model->removeRows (0, ledger_model->rowCount ());
|
||||
auto transaction (wallet.node.ledger.tx_begin_read ());
|
||||
for (auto i (wallet.node.ledger.store.account.begin (transaction)), j (wallet.node.ledger.store.account.end ()); i != j; ++i)
|
||||
for (auto i (wallet.node.ledger.store.account.begin (transaction)), j (wallet.node.ledger.store.account.end (transaction)); i != j; ++i)
|
||||
{
|
||||
QList<QStandardItem *> items;
|
||||
items.push_back (new QStandardItem (QString (i->first.to_account ().c_str ())));
|
||||
|
|
|
@ -721,7 +721,7 @@ TEST (rpc, account_move)
|
|||
ASSERT_TRUE (destination->exists (key.pub));
|
||||
ASSERT_TRUE (destination->exists (nano::dev::genesis_key.pub));
|
||||
auto transaction (node->wallets.tx_begin_read ());
|
||||
ASSERT_EQ (source->store.end (), source->store.begin (transaction));
|
||||
ASSERT_EQ (source->store.end (transaction), source->store.begin (transaction));
|
||||
}
|
||||
|
||||
TEST (rpc, block)
|
||||
|
@ -6212,7 +6212,7 @@ TEST (rpc, epoch_upgrade)
|
|||
{
|
||||
auto transaction (node->ledger.tx_begin_read ());
|
||||
ASSERT_EQ (2, node->store.account.count (transaction));
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (); ++i)
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (transaction); ++i)
|
||||
{
|
||||
nano::account_info info (i->second);
|
||||
ASSERT_EQ (info.epoch (), nano::epoch::epoch_0);
|
||||
|
@ -6230,7 +6230,7 @@ TEST (rpc, epoch_upgrade)
|
|||
{
|
||||
auto transaction (node->ledger.tx_begin_read ());
|
||||
ASSERT_EQ (4, node->store.account.count (transaction));
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (); ++i)
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (transaction); ++i)
|
||||
{
|
||||
nano::account_info info (i->second);
|
||||
ASSERT_EQ (info.epoch (), nano::epoch::epoch_1);
|
||||
|
@ -6293,7 +6293,7 @@ TEST (rpc, epoch_upgrade)
|
|||
{
|
||||
auto transaction (node->ledger.tx_begin_read ());
|
||||
ASSERT_EQ (5, node->store.account.count (transaction));
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (); ++i)
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (transaction); ++i)
|
||||
{
|
||||
nano::account_info info (i->second);
|
||||
ASSERT_EQ (info.epoch (), nano::epoch::epoch_2);
|
||||
|
@ -6375,7 +6375,7 @@ TEST (rpc, epoch_upgrade_multithreaded)
|
|||
{
|
||||
auto transaction (node->ledger.tx_begin_read ());
|
||||
ASSERT_EQ (2, node->store.account.count (transaction));
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (); ++i)
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (transaction); ++i)
|
||||
{
|
||||
nano::account_info info (i->second);
|
||||
ASSERT_EQ (info.epoch (), nano::epoch::epoch_0);
|
||||
|
@ -6394,7 +6394,7 @@ TEST (rpc, epoch_upgrade_multithreaded)
|
|||
{
|
||||
auto transaction (node->ledger.tx_begin_read ());
|
||||
ASSERT_EQ (4, node->store.account.count (transaction));
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (); ++i)
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (transaction); ++i)
|
||||
{
|
||||
nano::account_info info (i->second);
|
||||
ASSERT_EQ (info.epoch (), nano::epoch::epoch_1);
|
||||
|
@ -6457,7 +6457,7 @@ TEST (rpc, epoch_upgrade_multithreaded)
|
|||
{
|
||||
auto transaction (node->ledger.tx_begin_read ());
|
||||
ASSERT_EQ (5, node->store.account.count (transaction));
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (); ++i)
|
||||
for (auto i (node->store.account.begin (transaction)); i != node->store.account.end (transaction); ++i)
|
||||
{
|
||||
nano::account_info info (i->second);
|
||||
ASSERT_EQ (info.epoch (), nano::epoch::epoch_2);
|
||||
|
|
|
@ -1429,12 +1429,12 @@ bool nano::ledger::migrate_lmdb_to_rocksdb (std::filesystem::path const & data_p
|
|||
auto rocksdb_transaction (rocksdb_store->tx_begin_write ());
|
||||
rocksdb_store->version.put (rocksdb_transaction, version);
|
||||
|
||||
for (auto i (store.online_weight.begin (lmdb_transaction)), n (store.online_weight.end ()); i != n; ++i)
|
||||
for (auto i (store.online_weight.begin (lmdb_transaction)), n (store.online_weight.end (lmdb_transaction)); i != n; ++i)
|
||||
{
|
||||
rocksdb_store->online_weight.put (rocksdb_transaction, i->first, i->second);
|
||||
}
|
||||
|
||||
for (auto i (store.peer.begin (lmdb_transaction)), n (store.peer.end ()); i != n; ++i)
|
||||
for (auto i (store.peer.begin (lmdb_transaction)), n (store.peer.end (lmdb_transaction)); i != n; ++i)
|
||||
{
|
||||
rocksdb_store->peer.put (rocksdb_transaction, i->first, i->second);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ uint64_t nano::ledger_set_any::account_height (secure::transaction const & trans
|
|||
auto nano::ledger_set_any::account_lower_bound (secure::transaction const & transaction, nano::account const & account) const -> account_iterator
|
||||
{
|
||||
auto disk = ledger.store.account.begin (transaction, account);
|
||||
if (disk == ledger.store.account.end ())
|
||||
if (disk == ledger.store.account.end (transaction))
|
||||
{
|
||||
return account_iterator{};
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ uint64_t nano::ledger_set_any::block_height (secure::transaction const & transac
|
|||
std::optional<std::pair<nano::pending_key, nano::pending_info>> nano::ledger_set_any::receivable_lower_bound (secure::transaction const & transaction, nano::account const & account, nano::block_hash const & hash) const
|
||||
{
|
||||
auto result = ledger.store.pending.begin (transaction, { account, hash });
|
||||
if (result == ledger.store.pending.end ())
|
||||
if (result == ledger.store.pending.end (transaction))
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
|
|
@ -108,11 +108,11 @@ auto nano::ledger_set_confirmed::receivable_upper_bound (secure::transaction con
|
|||
std::optional<std::pair<nano::pending_key, nano::pending_info>> nano::ledger_set_confirmed::receivable_lower_bound (secure::transaction const & transaction, nano::account const & account, nano::block_hash const & hash) const
|
||||
{
|
||||
auto result = ledger.store.pending.begin (transaction, { account, hash });
|
||||
while (result != ledger.store.pending.end () && !block_exists (transaction, result->first.hash))
|
||||
while (result != ledger.store.pending.end (transaction) && !block_exists (transaction, result->first.hash))
|
||||
{
|
||||
++result;
|
||||
}
|
||||
if (result == ledger.store.pending.end ())
|
||||
if (result == ledger.store.pending.end (transaction))
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ size_t manually_count_pruned_blocks (nano::store::component & store)
|
|||
size_t count = 0;
|
||||
auto transaction = store.tx_begin_read ();
|
||||
auto i = store.pruned.begin (transaction);
|
||||
for (; i != store.pruned.end (); ++i)
|
||||
for (; i != store.pruned.end (transaction); ++i)
|
||||
{
|
||||
++count;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ TEST (system, generate_mass_activity)
|
|||
uint32_t count (20);
|
||||
system.generate_mass_activity (count, *system.nodes[0]);
|
||||
auto transaction (system.nodes[0]->store.tx_begin_read ());
|
||||
for (auto i (system.nodes[0]->store.account.begin (transaction)), n (system.nodes[0]->store.account.end ()); i != n; ++i)
|
||||
for (auto i (system.nodes[0]->store.account.begin (transaction)), n (system.nodes[0]->store.account.end (transaction)); i != n; ++i)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ TEST (system, generate_mass_activity_long)
|
|||
}
|
||||
system.generate_mass_activity (count, *system.nodes[0]);
|
||||
auto transaction (system.nodes[0]->store.tx_begin_read ());
|
||||
for (auto i (system.nodes[0]->store.account.begin (transaction)), n (system.nodes[0]->store.account.end ()); i != n; ++i)
|
||||
for (auto i (system.nodes[0]->store.account.begin (transaction)), n (system.nodes[0]->store.account.end (transaction)); i != n; ++i)
|
||||
{
|
||||
}
|
||||
system.stop ();
|
||||
|
@ -694,7 +694,7 @@ TEST (confirmation_height, many_accounts_single_confirmation)
|
|||
|
||||
// All frontiers (except last) should have 2 blocks and both should be confirmed
|
||||
auto transaction = node->store.tx_begin_read ();
|
||||
for (auto i (node->store.account.begin (transaction)), n (node->store.account.end ()); i != n; ++i)
|
||||
for (auto i (node->store.account.begin (transaction)), n (node->store.account.end (transaction)); i != n; ++i)
|
||||
{
|
||||
auto & account = i->first;
|
||||
auto & account_info = i->second;
|
||||
|
@ -706,7 +706,7 @@ TEST (confirmation_height, many_accounts_single_confirmation)
|
|||
}
|
||||
|
||||
size_t cemented_count = 0;
|
||||
for (auto i (node->ledger.store.confirmation_height.begin (transaction)), n (node->ledger.store.confirmation_height.end ()); i != n; ++i)
|
||||
for (auto i (node->ledger.store.confirmation_height.begin (transaction)), n (node->ledger.store.confirmation_height.end (transaction)); i != n; ++i)
|
||||
{
|
||||
cemented_count += i->second.height;
|
||||
}
|
||||
|
@ -782,7 +782,7 @@ TEST (confirmation_height, many_accounts_many_confirmations)
|
|||
|
||||
auto transaction = node->store.tx_begin_read ();
|
||||
size_t cemented_count = 0;
|
||||
for (auto i (node->ledger.store.confirmation_height.begin (transaction)), n (node->ledger.store.confirmation_height.end ()); i != n; ++i)
|
||||
for (auto i (node->ledger.store.confirmation_height.begin (transaction)), n (node->ledger.store.confirmation_height.end (transaction)); i != n; ++i)
|
||||
{
|
||||
cemented_count += i->second.height;
|
||||
}
|
||||
|
@ -925,7 +925,7 @@ TEST (confirmation_height, long_chains)
|
|||
ASSERT_EQ (num_blocks + 1, info->block_count);
|
||||
|
||||
size_t cemented_count = 0;
|
||||
for (auto i (node->ledger.store.confirmation_height.begin (transaction)), n (node->ledger.store.confirmation_height.end ()); i != n; ++i)
|
||||
for (auto i (node->ledger.store.confirmation_height.begin (transaction)), n (node->ledger.store.confirmation_height.end (transaction)); i != n; ++i)
|
||||
{
|
||||
cemented_count += i->second.height;
|
||||
}
|
||||
|
@ -1098,7 +1098,7 @@ TEST (confirmation_height, many_accounts_send_receive_self)
|
|||
|
||||
auto transaction = node->store.tx_begin_read ();
|
||||
size_t cemented_count = 0;
|
||||
for (auto i (node->ledger.store.confirmation_height.begin (transaction)), n (node->ledger.store.confirmation_height.end ()); i != n; ++i)
|
||||
for (auto i (node->ledger.store.confirmation_height.begin (transaction)), n (node->ledger.store.confirmation_height.end (transaction)); i != n; ++i)
|
||||
{
|
||||
cemented_count += i->second.height;
|
||||
}
|
||||
|
@ -1252,7 +1252,7 @@ TEST (confirmation_height, many_accounts_send_receive_self_no_elections)
|
|||
|
||||
auto transaction = store->tx_begin_read ();
|
||||
size_t cemented_count = 0;
|
||||
for (auto i (store->confirmation_height.begin (transaction)), n (store->confirmation_height.end ()); i != n; ++i)
|
||||
for (auto i (store->confirmation_height.begin (transaction)), n (store->confirmation_height.end (transaction)); i != n; ++i)
|
||||
{
|
||||
cemented_count += i->second.height;
|
||||
}
|
||||
|
@ -1746,7 +1746,7 @@ TEST (node, mass_epoch_upgrader)
|
|||
{
|
||||
auto transaction (node.store.tx_begin_read ());
|
||||
size_t block_count_sum = 0;
|
||||
for (auto i (node.store.account.begin (transaction)); i != node.store.account.end (); ++i)
|
||||
for (auto i (node.store.account.begin (transaction)); i != node.store.account.end (transaction); ++i)
|
||||
{
|
||||
nano::account_info info (i->second);
|
||||
ASSERT_EQ (info.epoch (), nano::epoch::epoch_1);
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
virtual iterator begin (store::transaction const &, nano::account const &) const = 0;
|
||||
virtual iterator begin (store::transaction const &) const = 0;
|
||||
virtual iterator rbegin (store::transaction const &) const = 0;
|
||||
virtual iterator end () const = 0;
|
||||
virtual iterator end (store::transaction const & transaction_a) const = 0;
|
||||
virtual void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const &) const = 0;
|
||||
};
|
||||
} // namespace nano::store
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
virtual uint64_t count (store::transaction const &) = 0;
|
||||
virtual iterator begin (store::transaction const &, nano::block_hash const &) const = 0;
|
||||
virtual iterator begin (store::transaction const &) const = 0;
|
||||
virtual iterator end () const = 0;
|
||||
virtual iterator end (store::transaction const &) const = 0;
|
||||
virtual void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const = 0;
|
||||
};
|
||||
} // namespace nano::store
|
||||
|
|
|
@ -28,7 +28,7 @@ nano::store::component::component (nano::store::block & block_store_a, nano::sto
|
|||
void nano::store::component::initialize (store::write_transaction const & transaction_a, nano::ledger_cache & ledger_cache_a, nano::ledger_constants & constants)
|
||||
{
|
||||
debug_assert (constants.genesis->has_sideband ());
|
||||
debug_assert (account.begin (transaction_a) == account.end ());
|
||||
debug_assert (account.begin (transaction_a) == account.end (transaction_a));
|
||||
auto hash_l (constants.genesis->hash ());
|
||||
block.put (transaction_a, hash_l, *constants.genesis);
|
||||
++ledger_cache_a.block_count;
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
virtual void clear (store::write_transaction const &) = 0;
|
||||
virtual iterator begin (store::transaction const & transaction_a, nano::account const & account_a) const = 0;
|
||||
virtual iterator begin (store::transaction const & transaction_a) const = 0;
|
||||
virtual iterator end () const = 0;
|
||||
virtual iterator end (store::transaction const & transaction_a) const = 0;
|
||||
virtual void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const &) const = 0;
|
||||
};
|
||||
} // namespace nano::store
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
virtual void clear (store::write_transaction const &) = 0;
|
||||
virtual iterator begin (store::transaction const & transaction_a, nano::qualified_root const & root_a) const = 0;
|
||||
virtual iterator begin (store::transaction const & transaction_a) const = 0;
|
||||
virtual iterator end () const = 0;
|
||||
virtual iterator end (store::transaction const & transaction_a) const = 0;
|
||||
virtual void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const = 0;
|
||||
};
|
||||
} // namespace nano::store
|
||||
|
|
|
@ -35,7 +35,7 @@ void nano::store::lmdb::account::del (store::write_transaction const & transacti
|
|||
bool nano::store::lmdb::account::exists (store::transaction const & transaction_a, nano::account const & account_a)
|
||||
{
|
||||
auto iterator (begin (transaction_a, account_a));
|
||||
return iterator != end () && nano::account (iterator->first) == account_a;
|
||||
return iterator != end (transaction_a) && nano::account (iterator->first) == account_a;
|
||||
}
|
||||
|
||||
size_t nano::store::lmdb::account::count (store::transaction const & transaction_a)
|
||||
|
@ -58,7 +58,7 @@ auto nano::store::lmdb::account::rbegin (store::transaction const & transaction_
|
|||
return store.make_iterator<nano::account, nano::account_info> (transaction_a, tables::accounts, false);
|
||||
}
|
||||
|
||||
auto nano::store::lmdb::account::end () const -> iterator
|
||||
auto nano::store::lmdb::account::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -68,6 +68,6 @@ void nano::store::lmdb::account::for_each_par (std::function<void (store::read_t
|
|||
parallel_traversal<nano::uint256_t> (
|
||||
[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
iterator begin (store::transaction const & transaction_a, nano::account const & account_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator rbegin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -111,11 +111,11 @@ std::shared_ptr<nano::block> nano::store::lmdb::block::random (store::transactio
|
|||
nano::block_hash hash;
|
||||
nano::random_pool::generate_block (hash.bytes.data (), hash.bytes.size ());
|
||||
auto existing = begin (transaction, hash);
|
||||
if (existing == end ())
|
||||
if (existing == end (transaction))
|
||||
{
|
||||
existing = begin (transaction);
|
||||
}
|
||||
debug_assert (existing != end ());
|
||||
debug_assert (existing != end (transaction));
|
||||
return existing->second.block;
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ auto nano::store::lmdb::block::begin (store::transaction const & transaction, na
|
|||
return store.make_iterator<nano::block_hash, nano::store::block_w_sideband> (transaction, tables::blocks, hash);
|
||||
}
|
||||
|
||||
auto nano::store::lmdb::block::end () const -> iterator
|
||||
auto nano::store::lmdb::block::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void nano::store::lmdb::block::for_each_par (std::function<void (store::read_tra
|
|||
parallel_traversal<nano::uint256_t> (
|
||||
[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
uint64_t count (store::transaction const & transaction_a) override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::block_hash const & hash_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -69,7 +69,7 @@ auto nano::store::lmdb::confirmation_height::begin (store::transaction const & t
|
|||
return store.make_iterator<nano::account, nano::confirmation_height_info> (transaction, tables::confirmation_height);
|
||||
}
|
||||
|
||||
auto nano::store::lmdb::confirmation_height::end () const -> iterator
|
||||
auto nano::store::lmdb::confirmation_height::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -79,6 +79,6 @@ void nano::store::lmdb::confirmation_height::for_each_par (std::function<void (s
|
|||
parallel_traversal<nano::uint256_t> (
|
||||
[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
void clear (store::write_transaction const & transaction_a) override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::account const & account_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
|
||||
/*
|
||||
|
|
|
@ -27,7 +27,7 @@ std::vector<nano::block_hash> nano::store::lmdb::final_vote::get (store::transac
|
|||
{
|
||||
std::vector<nano::block_hash> result;
|
||||
nano::qualified_root key_start{ root_a.raw, 0 };
|
||||
for (auto i = begin (transaction, key_start), n = end (); i != n && nano::qualified_root{ i->first }.root () == root_a; ++i)
|
||||
for (auto i = begin (transaction, key_start), n = end (transaction); i != n && nano::qualified_root{ i->first }.root () == root_a; ++i)
|
||||
{
|
||||
result.push_back (i->second);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ std::vector<nano::block_hash> nano::store::lmdb::final_vote::get (store::transac
|
|||
void nano::store::lmdb::final_vote::del (store::write_transaction const & transaction, nano::root const & root)
|
||||
{
|
||||
std::vector<nano::qualified_root> final_vote_qualified_roots;
|
||||
for (auto i = begin (transaction, nano::qualified_root{ root.raw, 0 }), n = end (); i != n && nano::qualified_root{ i->first }.root () == root; ++i)
|
||||
for (auto i = begin (transaction, nano::qualified_root{ root.raw, 0 }), n = end (transaction); i != n && nano::qualified_root{ i->first }.root () == root; ++i)
|
||||
{
|
||||
final_vote_qualified_roots.push_back (i->first);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ auto nano::store::lmdb::final_vote::begin (store::transaction const & transactio
|
|||
return store.make_iterator<nano::qualified_root, nano::block_hash> (transaction, tables::final_votes);
|
||||
}
|
||||
|
||||
auto nano::store::lmdb::final_vote::end () const -> iterator
|
||||
auto nano::store::lmdb::final_vote::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -84,6 +84,6 @@ void nano::store::lmdb::final_vote::for_each_par (std::function<void (store::rea
|
|||
parallel_traversal<nano::uint512_t> (
|
||||
[&action_a, this] (nano::uint512_t const & start, nano::uint512_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
void clear (store::write_transaction const & transaction_a) override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::qualified_root const & root_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -258,7 +258,7 @@ void nano::store::lmdb::component::upgrade_v22_to_v23 (store::write_transaction
|
|||
drop (transaction, tables::rep_weights);
|
||||
transaction.refresh ();
|
||||
|
||||
release_assert (rep_weight.begin (tx_begin_read ()) == rep_weight.end (), "rep weights table must be empty before upgrading to v23");
|
||||
release_assert (rep_weight.begin (tx_begin_read ()) == rep_weight.end (transaction), "rep weights table must be empty before upgrading to v23");
|
||||
|
||||
auto iterate_accounts = [this] (auto && func) {
|
||||
auto transaction = tx_begin_read ();
|
||||
|
|
|
@ -28,7 +28,7 @@ auto nano::store::lmdb::online_weight::rbegin (store::transaction const & transa
|
|||
return store.make_iterator<uint64_t, nano::amount> (transaction, tables::online_weight, false);
|
||||
}
|
||||
|
||||
auto nano::store::lmdb::online_weight::end () const -> iterator
|
||||
auto nano::store::lmdb::online_weight::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public:
|
|||
void del (store::write_transaction const & transaction_a, uint64_t time_a) override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator rbegin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
size_t count (store::transaction const & transaction_a) const override;
|
||||
void clear (store::write_transaction const & transaction_a) override;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ auto nano::store::lmdb::peer::begin (store::transaction const & transaction) con
|
|||
return store.make_iterator<nano::endpoint_key, nano::millis_t> (transaction, tables::peers);
|
||||
}
|
||||
|
||||
auto nano::store::lmdb::peer::end () const -> iterator
|
||||
auto nano::store::lmdb::peer::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
size_t count (store::transaction const &) const override;
|
||||
void clear (store::write_transaction const &) override;
|
||||
iterator begin (store::transaction const &) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
|
||||
/*
|
||||
* Endpoints for peers
|
||||
|
|
|
@ -36,13 +36,13 @@ std::optional<nano::pending_info> nano::store::lmdb::pending::get (store::transa
|
|||
bool nano::store::lmdb::pending::exists (store::transaction const & transaction_a, nano::pending_key const & key_a)
|
||||
{
|
||||
auto iterator (begin (transaction_a, key_a));
|
||||
return iterator != end () && nano::pending_key (iterator->first) == key_a;
|
||||
return iterator != end (transaction_a) && nano::pending_key (iterator->first) == key_a;
|
||||
}
|
||||
|
||||
bool nano::store::lmdb::pending::any (store::transaction const & transaction_a, nano::account const & account_a)
|
||||
{
|
||||
auto iterator (begin (transaction_a, nano::pending_key (account_a, 0)));
|
||||
return iterator != end () && nano::pending_key (iterator->first).account == account_a;
|
||||
return iterator != end (transaction_a) && nano::pending_key (iterator->first).account == account_a;
|
||||
}
|
||||
|
||||
auto nano::store::lmdb::pending::begin (store::transaction const & transaction_a, nano::pending_key const & key_a) const -> iterator
|
||||
|
@ -55,7 +55,7 @@ auto nano::store::lmdb::pending::begin (store::transaction const & transaction_a
|
|||
return store.make_iterator<nano::pending_key, nano::pending_info> (transaction_a, tables::pending);
|
||||
}
|
||||
|
||||
auto nano::store::lmdb::pending::end () const -> iterator
|
||||
auto nano::store::lmdb::pending::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -69,6 +69,6 @@ void nano::store::lmdb::pending::for_each_par (std::function<void (store::read_t
|
|||
nano::pending_key key_start (union_start.uint256s[0].number (), union_start.uint256s[1].number ());
|
||||
nano::pending_key key_end (union_end.uint256s[0].number (), union_end.uint256s[1].number ());
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, key_start), !is_last ? this->begin (transaction, key_end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, key_start), !is_last ? this->begin (transaction, key_end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
bool any (store::transaction const & transaction_a, nano::account const & account_a) override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::pending_key const & key_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,11 +27,11 @@ nano::block_hash nano::store::lmdb::pruned::random (store::transaction const & t
|
|||
nano::block_hash random_hash;
|
||||
nano::random_pool::generate_block (random_hash.bytes.data (), random_hash.bytes.size ());
|
||||
auto existing = begin (transaction, random_hash);
|
||||
if (existing == end ())
|
||||
if (existing == end (transaction))
|
||||
{
|
||||
existing = begin (transaction);
|
||||
}
|
||||
return existing != end () ? existing->first : 0;
|
||||
return existing != end (transaction) ? existing->first : 0;
|
||||
}
|
||||
|
||||
size_t nano::store::lmdb::pruned::count (store::transaction const & transaction_a) const
|
||||
|
@ -55,7 +55,7 @@ auto nano::store::lmdb::pruned::begin (store::transaction const & transaction) c
|
|||
return store.make_iterator<nano::block_hash, std::nullptr_t> (transaction, tables::pruned);
|
||||
}
|
||||
|
||||
auto nano::store::lmdb::pruned::end () const -> iterator
|
||||
auto nano::store::lmdb::pruned::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -65,6 +65,6 @@ void nano::store::lmdb::pruned::for_each_par (std::function<void (store::read_tr
|
|||
parallel_traversal<nano::uint256_t> (
|
||||
[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
void clear (store::write_transaction const & transaction_a) override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::block_hash const & hash_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ auto nano::store::lmdb::rep_weight::begin (store::transaction const & transactio
|
|||
return store.make_iterator<nano::account, nano::uint128_union> (transaction_a, tables::rep_weights);
|
||||
}
|
||||
|
||||
auto nano::store::lmdb::rep_weight::end () const -> iterator
|
||||
auto nano::store::lmdb::rep_weight::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -63,6 +63,6 @@ void nano::store::lmdb::rep_weight::for_each_par (std::function<void (store::rea
|
|||
parallel_traversal<nano::uint256_t> (
|
||||
[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
void del (store::write_transaction const &, nano::account const & representative_a) override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::account const & representative_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
virtual void del (store::write_transaction const &, uint64_t) = 0;
|
||||
virtual iterator begin (store::transaction const &) const = 0;
|
||||
virtual iterator rbegin (store::transaction const &) const = 0;
|
||||
virtual iterator end () const = 0;
|
||||
virtual iterator end (store::transaction const & transaction_a) const = 0;
|
||||
virtual size_t count (store::transaction const &) const = 0;
|
||||
virtual void clear (store::write_transaction const &) = 0;
|
||||
};
|
||||
|
|
|
@ -29,6 +29,6 @@ public:
|
|||
virtual size_t count (store::transaction const &) const = 0;
|
||||
virtual void clear (store::write_transaction const &) = 0;
|
||||
virtual iterator begin (store::transaction const &) const = 0;
|
||||
virtual iterator end () const = 0;
|
||||
virtual iterator end (store::transaction const & transaction_a) const = 0;
|
||||
};
|
||||
} // namespace nano::store
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
virtual bool any (store::transaction const &, nano::account const &) = 0;
|
||||
virtual iterator begin (store::transaction const &, nano::pending_key const &) const = 0;
|
||||
virtual iterator begin (store::transaction const &) const = 0;
|
||||
virtual iterator end () const = 0;
|
||||
virtual iterator end (store::transaction const & transaction_a) const = 0;
|
||||
virtual void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const = 0;
|
||||
};
|
||||
} // namespace nano::store
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
virtual void clear (store::write_transaction const &) = 0;
|
||||
virtual iterator begin (store::transaction const & transaction_a, nano::block_hash const & hash_a) const = 0;
|
||||
virtual iterator begin (store::transaction const & transaction_a) const = 0;
|
||||
virtual iterator end () const = 0;
|
||||
virtual iterator end (store::transaction const & transaction_a) const = 0;
|
||||
virtual void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const = 0;
|
||||
};
|
||||
} // namespace nano::store
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
virtual void del (store::write_transaction const &, nano::account const & representative_a) = 0;
|
||||
virtual iterator begin (store::transaction const & transaction_a, nano::account const & representative_a) const = 0;
|
||||
virtual iterator begin (store::transaction const & transaction_a) const = 0;
|
||||
virtual iterator end () const = 0;
|
||||
virtual iterator end (store::transaction const & transaction_a) const = 0;
|
||||
virtual void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const = 0;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ void nano::store::rocksdb::account::del (store::write_transaction const & transa
|
|||
bool nano::store::rocksdb::account::exists (store::transaction const & transaction_a, nano::account const & account_a)
|
||||
{
|
||||
auto iterator (begin (transaction_a, account_a));
|
||||
return iterator != end () && nano::account (iterator->first) == account_a;
|
||||
return iterator != end (transaction_a) && nano::account (iterator->first) == account_a;
|
||||
}
|
||||
|
||||
size_t nano::store::rocksdb::account::count (store::transaction const & transaction_a)
|
||||
|
@ -57,7 +57,7 @@ auto nano::store::rocksdb::account::rbegin (store::transaction const & transacti
|
|||
return store.make_iterator<nano::account, nano::account_info> (transaction_a, tables::accounts, false);
|
||||
}
|
||||
|
||||
auto nano::store::rocksdb::account::end () const -> iterator
|
||||
auto nano::store::rocksdb::account::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -67,6 +67,6 @@ void nano::store::rocksdb::account::for_each_par (std::function<void (store::rea
|
|||
parallel_traversal<nano::uint256_t> (
|
||||
[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
iterator begin (store::transaction const & transaction_a, nano::account const & account_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator rbegin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
};
|
||||
} // namespace nano::store::rocksdb
|
||||
|
|
|
@ -110,11 +110,11 @@ std::shared_ptr<nano::block> nano::store::rocksdb::block::random (store::transac
|
|||
nano::block_hash hash;
|
||||
nano::random_pool::generate_block (hash.bytes.data (), hash.bytes.size ());
|
||||
auto existing = begin (transaction, hash);
|
||||
if (existing == end ())
|
||||
if (existing == end (transaction))
|
||||
{
|
||||
existing = begin (transaction);
|
||||
}
|
||||
debug_assert (existing != end ());
|
||||
debug_assert (existing != end (transaction));
|
||||
return existing->second.block;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ auto nano::store::rocksdb::block::begin (store::transaction const & transaction,
|
|||
return store.make_iterator<nano::block_hash, nano::store::block_w_sideband> (transaction, tables::blocks, hash);
|
||||
}
|
||||
|
||||
auto nano::store::rocksdb::block::end () const -> iterator
|
||||
auto nano::store::rocksdb::block::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ void nano::store::rocksdb::block::for_each_par (std::function<void (store::read_
|
|||
parallel_traversal<nano::uint256_t> (
|
||||
[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
uint64_t count (store::transaction const & transaction_a) override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::block_hash const & hash_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -69,7 +69,7 @@ auto nano::store::rocksdb::confirmation_height::begin (store::transaction const
|
|||
return store.make_iterator<nano::account, nano::confirmation_height_info> (transaction, tables::confirmation_height);
|
||||
}
|
||||
|
||||
auto nano::store::rocksdb::confirmation_height::end () const -> iterator
|
||||
auto nano::store::rocksdb::confirmation_height::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -79,6 +79,6 @@ void nano::store::rocksdb::confirmation_height::for_each_par (std::function<void
|
|||
parallel_traversal<nano::uint256_t> (
|
||||
[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
void clear (store::write_transaction const & transaction_a) override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::account const & account_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
};
|
||||
} // namespace nano::store::rocksdb
|
||||
|
|
|
@ -27,7 +27,7 @@ std::vector<nano::block_hash> nano::store::rocksdb::final_vote::get (store::tran
|
|||
{
|
||||
std::vector<nano::block_hash> result;
|
||||
nano::qualified_root key_start{ root_a.raw, 0 };
|
||||
for (auto i = begin (transaction, key_start), n = end (); i != n && nano::qualified_root{ i->first }.root () == root_a; ++i)
|
||||
for (auto i = begin (transaction, key_start), n = end (transaction); i != n && nano::qualified_root{ i->first }.root () == root_a; ++i)
|
||||
{
|
||||
result.push_back (i->second);
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ std::vector<nano::block_hash> nano::store::rocksdb::final_vote::get (store::tran
|
|||
void nano::store::rocksdb::final_vote::del (store::write_transaction const & transaction, nano::root const & root)
|
||||
{
|
||||
std::vector<nano::qualified_root> final_vote_qualified_roots;
|
||||
for (auto i = begin (transaction, nano::qualified_root{ root.raw, 0 }), n = end (); i != n && nano::qualified_root{ i->first }.root () == root; ++i)
|
||||
for (auto i = begin (transaction, nano::qualified_root{ root.raw, 0 }), n = end (transaction); i != n && nano::qualified_root{ i->first }.root () == root; ++i)
|
||||
{
|
||||
final_vote_qualified_roots.push_back (i->first);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ auto nano::store::rocksdb::final_vote::begin (store::transaction const & transac
|
|||
return store.make_iterator<nano::qualified_root, nano::block_hash> (transaction, tables::final_votes);
|
||||
}
|
||||
|
||||
auto nano::store::rocksdb::final_vote::end () const -> iterator
|
||||
auto nano::store::rocksdb::final_vote::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -84,6 +84,6 @@ void nano::store::rocksdb::final_vote::for_each_par (std::function<void (store::
|
|||
parallel_traversal<nano::uint512_t> (
|
||||
[&action_a, this] (nano::uint512_t const & start, nano::uint512_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
void clear (store::write_transaction const & transaction_a) override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::qualified_root const & root_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
};
|
||||
} // namespace nano::store::rocksdb
|
||||
|
|
|
@ -28,7 +28,7 @@ auto nano::store::rocksdb::online_weight::rbegin (store::transaction const & tra
|
|||
return store.make_iterator<uint64_t, nano::amount> (transaction, tables::online_weight, false);
|
||||
}
|
||||
|
||||
auto nano::store::rocksdb::online_weight::end () const -> iterator
|
||||
auto nano::store::rocksdb::online_weight::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
void del (store::write_transaction const & transaction_a, uint64_t time_a) override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator rbegin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
size_t count (store::transaction const & transaction_a) const override;
|
||||
void clear (store::write_transaction const & transaction_a) override;
|
||||
};
|
||||
|
|
|
@ -50,7 +50,7 @@ auto nano::store::rocksdb::peer::begin (store::transaction const & transaction)
|
|||
return store.make_iterator<nano::endpoint_key, nano::millis_t> (transaction, tables::peers);
|
||||
}
|
||||
|
||||
auto nano::store::rocksdb::peer::end () const -> iterator
|
||||
auto nano::store::rocksdb::peer::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ public:
|
|||
size_t count (store::transaction const &) const override;
|
||||
void clear (store::write_transaction const &) override;
|
||||
iterator begin (store::transaction const &) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
};
|
||||
} // namespace nano::store::rocksdb
|
||||
|
|
|
@ -36,13 +36,13 @@ std::optional<nano::pending_info> nano::store::rocksdb::pending::get (store::tra
|
|||
bool nano::store::rocksdb::pending::exists (store::transaction const & transaction_a, nano::pending_key const & key_a)
|
||||
{
|
||||
auto iterator (begin (transaction_a, key_a));
|
||||
return iterator != end () && nano::pending_key (iterator->first) == key_a;
|
||||
return iterator != end (transaction_a) && nano::pending_key (iterator->first) == key_a;
|
||||
}
|
||||
|
||||
bool nano::store::rocksdb::pending::any (store::transaction const & transaction_a, nano::account const & account_a)
|
||||
{
|
||||
auto iterator (begin (transaction_a, nano::pending_key (account_a, 0)));
|
||||
return iterator != end () && nano::pending_key (iterator->first).account == account_a;
|
||||
return iterator != end (transaction_a) && nano::pending_key (iterator->first).account == account_a;
|
||||
}
|
||||
|
||||
auto nano::store::rocksdb::pending::begin (store::transaction const & transaction_a, nano::pending_key const & key_a) const -> iterator
|
||||
|
@ -55,7 +55,7 @@ auto nano::store::rocksdb::pending::begin (store::transaction const & transactio
|
|||
return store.template make_iterator<nano::pending_key, nano::pending_info> (transaction_a, tables::pending);
|
||||
}
|
||||
|
||||
auto nano::store::rocksdb::pending::end () const -> iterator
|
||||
auto nano::store::rocksdb::pending::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -69,6 +69,6 @@ void nano::store::rocksdb::pending::for_each_par (std::function<void (store::rea
|
|||
nano::pending_key key_start (union_start.uint256s[0].number (), union_start.uint256s[1].number ());
|
||||
nano::pending_key key_end (union_end.uint256s[0].number (), union_end.uint256s[1].number ());
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, key_start), !is_last ? this->begin (transaction, key_end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, key_start), !is_last ? this->begin (transaction, key_end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
bool any (store::transaction const & transaction_a, nano::account const & account_a) override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::pending_key const & key_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
};
|
||||
} // namespace nano::store::rocksdb
|
||||
|
|
|
@ -27,11 +27,11 @@ nano::block_hash nano::store::rocksdb::pruned::random (store::transaction const
|
|||
nano::block_hash random_hash;
|
||||
nano::random_pool::generate_block (random_hash.bytes.data (), random_hash.bytes.size ());
|
||||
auto existing = begin (transaction, random_hash);
|
||||
if (existing == end ())
|
||||
if (existing == end (transaction))
|
||||
{
|
||||
existing = begin (transaction);
|
||||
}
|
||||
return existing != end () ? existing->first : 0;
|
||||
return existing != end (transaction) ? existing->first : 0;
|
||||
}
|
||||
|
||||
size_t nano::store::rocksdb::pruned::count (store::transaction const & transaction_a) const
|
||||
|
@ -55,7 +55,7 @@ auto nano::store::rocksdb::pruned::begin (store::transaction const & transaction
|
|||
return store.make_iterator<nano::block_hash, std::nullptr_t> (transaction_a, tables::pruned);
|
||||
}
|
||||
|
||||
auto nano::store::rocksdb::pruned::end () const -> iterator
|
||||
auto nano::store::rocksdb::pruned::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -65,6 +65,6 @@ void nano::store::rocksdb::pruned::for_each_par (std::function<void (store::read
|
|||
parallel_traversal<nano::uint256_t> (
|
||||
[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
void clear (store::write_transaction const & transaction_a) override;
|
||||
iterator begin (store::transaction const & transaction_a, nano::block_hash const & hash_a) const override;
|
||||
iterator begin (store::transaction const & transaction_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
};
|
||||
} // namespace nano::store::rocksdb
|
||||
|
|
|
@ -52,7 +52,7 @@ auto nano::store::rocksdb::rep_weight::begin (store::transaction const & txn_a)
|
|||
return store.make_iterator<nano::account, nano::uint128_union> (txn_a, tables::rep_weights);
|
||||
}
|
||||
|
||||
auto nano::store::rocksdb::rep_weight::end () const -> iterator
|
||||
auto nano::store::rocksdb::rep_weight::end (store::transaction const & transaction_a) const -> iterator
|
||||
{
|
||||
return iterator{ nullptr };
|
||||
}
|
||||
|
@ -62,6 +62,6 @@ void nano::store::rocksdb::rep_weight::for_each_par (std::function<void (store::
|
|||
parallel_traversal<nano::uint256_t> (
|
||||
[&action_a, this] (nano::uint256_t const & start, nano::uint256_t const & end, bool const is_last) {
|
||||
auto transaction (this->store.tx_begin_read ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end ());
|
||||
action_a (transaction, this->begin (transaction, start), !is_last ? this->begin (transaction, end) : this->end (transaction));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
void del (store::write_transaction const &, nano::account const & representative_a) override;
|
||||
iterator begin (store::transaction const & txn_a, nano::account const & representative_a) const override;
|
||||
iterator begin (store::transaction const & txn_a) const override;
|
||||
iterator end () const override;
|
||||
iterator end (store::transaction const & transaction_a) const override;
|
||||
void for_each_par (std::function<void (store::read_transaction const &, iterator, iterator)> const & action_a) const override;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -292,7 +292,10 @@ void nano::store::rocksdb::component::upgrade_v22_to_v23 (store::write_transacti
|
|||
transaction.refresh ();
|
||||
}
|
||||
|
||||
release_assert (rep_weight.begin (tx_begin_read ()) == rep_weight.end (), "rep weights table must be empty before upgrading to v23");
|
||||
{
|
||||
auto tx = tx_begin_read ();
|
||||
release_assert (rep_weight.begin (tx) == rep_weight.end (tx), "rep weights table must be empty before upgrading to v23");
|
||||
}
|
||||
|
||||
auto iterate_accounts = [this] (auto && func) {
|
||||
auto transaction = tx_begin_read ();
|
||||
|
@ -598,14 +601,14 @@ uint64_t nano::store::rocksdb::component::count (store::transaction const & tran
|
|||
// Peers/online weight are small enough that they can just be iterated to get accurate counts.
|
||||
if (table_a == tables::peers)
|
||||
{
|
||||
for (auto i (peer.begin (transaction_a)), n (peer.end ()); i != n; ++i)
|
||||
for (auto i (peer.begin (transaction_a)), n (peer.end (transaction_a)); i != n; ++i)
|
||||
{
|
||||
++sum;
|
||||
}
|
||||
}
|
||||
else if (table_a == tables::online_weight)
|
||||
{
|
||||
for (auto i (online_weight.begin (transaction_a)), n (online_weight.end ()); i != n; ++i)
|
||||
for (auto i (online_weight.begin (transaction_a)), n (online_weight.end (transaction_a)); i != n; ++i)
|
||||
{
|
||||
++sum;
|
||||
}
|
||||
|
@ -624,7 +627,7 @@ uint64_t nano::store::rocksdb::component::count (store::transaction const & tran
|
|||
// otherwise there can be performance issues.
|
||||
else if (table_a == tables::accounts)
|
||||
{
|
||||
for (auto i (account.begin (transaction_a)), n (account.end ()); i != n; ++i)
|
||||
for (auto i (account.begin (transaction_a)), n (account.end (transaction_a)); i != n; ++i)
|
||||
{
|
||||
++sum;
|
||||
}
|
||||
|
@ -632,14 +635,14 @@ uint64_t nano::store::rocksdb::component::count (store::transaction const & tran
|
|||
else if (table_a == tables::blocks)
|
||||
{
|
||||
// This is also used in some CLI commands
|
||||
for (auto i (block.begin (transaction_a)), n (block.end ()); i != n; ++i)
|
||||
for (auto i (block.begin (transaction_a)), n (block.end (transaction_a)); i != n; ++i)
|
||||
{
|
||||
++sum;
|
||||
}
|
||||
}
|
||||
else if (table_a == tables::confirmation_height)
|
||||
{
|
||||
for (auto i (confirmation_height.begin (transaction_a)), n (confirmation_height.end ()); i != n; ++i)
|
||||
for (auto i (confirmation_height.begin (transaction_a)), n (confirmation_height.end (transaction_a)); i != n; ++i)
|
||||
{
|
||||
++sum;
|
||||
}
|
||||
|
@ -647,7 +650,7 @@ uint64_t nano::store::rocksdb::component::count (store::transaction const & tran
|
|||
// rep_weights should only be used in tests otherwise there can be performance issues.
|
||||
else if (table_a == tables::rep_weights)
|
||||
{
|
||||
for (auto i (rep_weight.begin (transaction_a)), n (rep_weight.end ()); i != n; ++i)
|
||||
for (auto i (rep_weight.begin (transaction_a)), n (rep_weight.end (transaction_a)); i != n; ++i)
|
||||
{
|
||||
++sum;
|
||||
}
|
||||
|
@ -673,7 +676,7 @@ int nano::store::rocksdb::component::drop (store::write_transaction const & tran
|
|||
if (table_a == tables::peers)
|
||||
{
|
||||
int status = 0;
|
||||
for (auto i = peer.begin (transaction_a), n = peer.end (); i != n; ++i)
|
||||
for (auto i = peer.begin (transaction_a), n = peer.end (transaction_a); i != n; ++i)
|
||||
{
|
||||
status = del (transaction_a, tables::peers, nano::store::rocksdb::db_val (i->first));
|
||||
release_assert (success (status));
|
||||
|
|
|
@ -257,9 +257,9 @@ nano::account nano::test::system::account (store::transaction const & transactio
|
|||
{
|
||||
auto wallet_l (wallet (index_a));
|
||||
auto keys (wallet_l->store.begin (transaction_a));
|
||||
debug_assert (keys != wallet_l->store.end ());
|
||||
debug_assert (keys != wallet_l->store.end (transaction_a));
|
||||
auto result (keys->first);
|
||||
debug_assert (++keys == wallet_l->store.end ());
|
||||
debug_assert (++keys == wallet_l->store.end (transaction_a));
|
||||
return nano::account (result);
|
||||
}
|
||||
|
||||
|
@ -533,11 +533,11 @@ void nano::test::system::generate_send_existing (nano::node & node_a, std::vecto
|
|||
random_pool::generate_block (account.bytes.data (), sizeof (account.bytes));
|
||||
auto transaction = node_a.ledger.tx_begin_read ();
|
||||
auto entry = node_a.store.account.begin (transaction, account);
|
||||
if (entry == node_a.store.account.end ())
|
||||
if (entry == node_a.store.account.end (transaction))
|
||||
{
|
||||
entry = node_a.store.account.begin (transaction);
|
||||
}
|
||||
debug_assert (entry != node_a.store.account.end ());
|
||||
debug_assert (entry != node_a.store.account.end (transaction));
|
||||
destination = nano::account (entry->first);
|
||||
source = get_random_account (accounts_a);
|
||||
amount = get_random_amount (transaction, node_a, source);
|
||||
|
|
|
@ -315,7 +315,7 @@ void nano::test::print_all_receivable_entries (const nano::store::component & st
|
|||
{
|
||||
std::cout << "Printing all receivable entries:\n";
|
||||
auto const tx = store.tx_begin_read ();
|
||||
auto const end = store.pending.end ();
|
||||
auto const end = store.pending.end (tx);
|
||||
for (auto i = store.pending.begin (tx); i != end; ++i)
|
||||
{
|
||||
std::cout << "Key: " << i->first << std::endl;
|
||||
|
@ -327,7 +327,7 @@ void nano::test::print_all_account_info (const nano::ledger & ledger)
|
|||
{
|
||||
std::cout << "Printing all account info:\n";
|
||||
auto const tx = ledger.tx_begin_read ();
|
||||
auto const end = ledger.store.account.end ();
|
||||
auto const end = ledger.store.account.end (tx);
|
||||
for (auto i = ledger.store.account.begin (tx); i != end; ++i)
|
||||
{
|
||||
nano::account acc = i->first;
|
||||
|
@ -349,7 +349,7 @@ void nano::test::print_all_blocks (const nano::store::component & store)
|
|||
{
|
||||
auto tx = store.tx_begin_read ();
|
||||
auto i = store.block.begin (tx);
|
||||
auto end = store.block.end ();
|
||||
auto end = store.block.end (tx);
|
||||
std::cout << "Listing all blocks" << std::endl;
|
||||
for (; i != end; ++i)
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ std::vector<std::shared_ptr<nano::block>> nano::test::all_blocks (nano::node & n
|
|||
{
|
||||
auto transaction = node.store.tx_begin_read ();
|
||||
std::vector<std::shared_ptr<nano::block>> result;
|
||||
for (auto it = node.store.block.begin (transaction), end = node.store.block.end (); it != end; ++it)
|
||||
for (auto it = node.store.block.begin (transaction), end = node.store.block.end (transaction); it != end; ++it)
|
||||
{
|
||||
result.push_back (it->second.block);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue