Skip to content

Commit

Permalink
Notify about vacancy change
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Sep 5, 2024
1 parent 441c5db commit d631c02
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions nano/node/active_elections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,19 @@ void nano::active_elections::add_election_winner_details (nano::block_hash const

std::shared_ptr<nano::election> nano::active_elections::remove_election_winner_details (nano::block_hash const & hash_a)
{
nano::lock_guard<nano::mutex> guard{ election_winner_details_mutex };
std::shared_ptr<nano::election> result;
auto existing = election_winner_details.find (hash_a);
if (existing != election_winner_details.end ())
{
result = existing->second;
election_winner_details.erase (existing);
nano::lock_guard<nano::mutex> guard{ election_winner_details_mutex };
auto existing = election_winner_details.find (hash_a);
if (existing != election_winner_details.end ())
{
result = existing->second;
election_winner_details.erase (existing);
}
}

vacancy_update ();

return result;
}

Expand Down Expand Up @@ -344,6 +349,7 @@ void nano::active_elections::cleanup_election (nano::unique_lock<nano::mutex> &
{
entry.erased_callback (election);
}

vacancy_update ();

for (auto const & [hash, block] : blocks_l)
Expand Down

0 comments on commit d631c02

Please sign in to comment.