Remove unnecessary unlock/lock of a mutex (#4416)

node.final_generator.add() used to do further work in the same context
and there was the possibility of a deadlock.
But now it just adds to a queue so there should not be a deadlock danger.
So the lock/unlock should not be needed.
This commit is contained in:
Dimitrios Siganos 2024-02-01 18:32:01 +07:00 committed by GitHub
commit b1be78507a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -366,10 +366,7 @@ void nano::election::confirm_if_quorum (nano::unique_lock<nano::mutex> & lock_a)
{
if (node.ledger.cache.final_votes_confirmation_canary.load () && !is_quorum.exchange (true) && node.config.enable_voting && node.wallets.reps ().voting > 0)
{
auto hash = status.winner->hash ();
lock_a.unlock ();
node.final_generator.add (root, hash);
lock_a.lock ();
node.final_generator.add (root, status.winner->hash ());
}
if (!node.ledger.cache.final_votes_confirmation_canary.load () || final_weight >= node.online_reps.delta ())
{