Fuse branches in epoch_upgrader::upgrade_impl

This commit is contained in:
Colin LeMahieu 2024-03-16 19:16:48 +00:00
commit cc90065630
No known key found for this signature in database
GPG key ID: 43708520C8DFB938

View file

@ -213,7 +213,6 @@ void nano::epoch_upgrader::upgrade_impl (nano::raw_key const & prv_a, nano::epoc
auto transaction = store.tx_begin_read (); auto transaction = store.tx_begin_read ();
for (auto current = ledger.receivable_upper_bound (transaction, 0), end = ledger.receivable_end (); current != end && attempts < upgrade_batch_size && attempts < count_limit && !stopped;) for (auto current = ledger.receivable_upper_bound (transaction, 0), end = ledger.receivable_end (); current != end && attempts < upgrade_batch_size && attempts < count_limit && !stopped;)
{ {
bool to_next_account (false);
auto const & [key, info] = *current; auto const & [key, info] = *current;
if (!store.account.exists (transaction, key.account)) if (!store.account.exists (transaction, key.account))
{ {
@ -257,12 +256,10 @@ void nano::epoch_upgrader::upgrade_impl (nano::raw_key const & prv_a, nano::epoc
upgrader_process (upgraded_pending, epoch, difficulty, signer, root, account); upgrader_process (upgraded_pending, epoch, difficulty, signer, root, account);
} }
} }
// Move to next pending item
current = ledger.receivable_upper_bound (transaction, key.account, key.hash);
} }
else else
{
to_next_account = true;
}
if (to_next_account)
{ {
// Move to next account if pending account exists or was upgraded // Move to next account if pending account exists or was upgraded
if (key.account.number () == std::numeric_limits<nano::uint256_t>::max ()) if (key.account.number () == std::numeric_limits<nano::uint256_t>::max ())
@ -274,11 +271,6 @@ void nano::epoch_upgrader::upgrade_impl (nano::raw_key const & prv_a, nano::epoc
current = ledger.receivable_upper_bound (transaction, key.account); current = ledger.receivable_upper_bound (transaction, key.account);
} }
} }
else
{
// Move to next pending item
current = ledger.receivable_upper_bound (transaction, key.account, key.hash);
}
} }
{ {
nano::unique_lock<nano::mutex> lock{ upgrader_mutex }; nano::unique_lock<nano::mutex> lock{ upgrader_mutex };