Simplified vote_generator logic

This commit is contained in:
RickiNano 2024-10-07 22:13:54 +02:00
commit b7b0395a03

View file

@ -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);
}
}
}
}