Skip to content

Commit

Permalink
Simplified vote_generator logic
Browse files Browse the repository at this point in the history
  • Loading branch information
RickiNano committed Oct 7, 2024
1 parent 7914c7c commit b7b0395
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions nano/node/vote_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,25 +289,19 @@ void nano::vote_generator::run ()
nano::unique_lock<nano::mutex> lock{ mutex };
while (!stopped)
{
if (candidates.size () >= nano::network::confirm_ack_hashes_max)
condition.wait_for (lock, config.vote_generator_delay, [this] () { return this->candidates.size () >= nano::network::confirm_ack_hashes_max || !requests.empty (); });

if (!candidates.empty ())
{
broadcast (lock);
}

if (!requests.empty ())
{
auto request (requests.front ());
requests.pop_front ();
reply (lock, std::move (request));
}
else
{
condition.wait_for (lock, config.vote_generator_delay, [this] () { return this->candidates.size () >= nano::network::confirm_ack_hashes_max; });

if (!candidates.empty ())
{
broadcast (lock);
}
}
}
}

Expand Down

0 comments on commit b7b0395

Please sign in to comment.