From 3ff72fd4e8d6758dee5758a78f66edbecd5736db Mon Sep 17 00:00:00 2001 From: Dimitrios Siganos Date: Thu, 1 Feb 2024 00:40:47 +0700 Subject: [PATCH] Remove unnecessary unlock/lock of a mutex 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. --- nano/node/election.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nano/node/election.cpp b/nano/node/election.cpp index 0ef35b349e..a8f03dae5a 100644 --- a/nano/node/election.cpp +++ b/nano/node/election.cpp @@ -366,10 +366,7 @@ void nano::election::confirm_if_quorum (nano::unique_lock & 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 ()) {