Skip to content

Commit

Permalink
Fix iteration in rai::bootstrap_attempt::lazy_finished (#1417)
Browse files Browse the repository at this point in the history
  • Loading branch information
PlasmaPower committed Nov 30, 2018
1 parent 8c654e8 commit 8fd1096
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rai/node/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1189,17 +1189,18 @@ bool rai::bootstrap_attempt::lazy_finished ()
bool result (true);
auto transaction (node->store.tx_begin_read ());
std::unique_lock<std::mutex> lock (lazy_mutex);
for (auto & hash : lazy_keys)
for (auto it (lazy_keys.begin ()), end (lazy_keys.end ()); it != end;)
{
if (node->store.block_exists (transaction, hash))
if (node->store.block_exists (transaction, *it))
{
// Could be not safe enough
lazy_keys.erase (hash);
it = lazy_keys.erase (it);
}
else
{
result = false;
break;
// No need to increment `it` as we break above.
}
}
return result;
Expand Down

0 comments on commit 8fd1096

Please sign in to comment.