From e071ebdaa82b4938de3233669046125ba4ac4f4d Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Mon, 12 Aug 2024 19:27:01 -0400 Subject: [PATCH] Removed lock acquiring for the method BlockCommitSigs. --- consensus/consensus_v2.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index 80f6d110ae..7a11e006fe 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -279,11 +279,10 @@ func (consensus *Consensus) BlockCommitSigs(blockNum uint64) ([]byte, error) { return nil, nil } lastCommits, err := consensus.Blockchain().ReadCommitSig(blockNum) - consensus.mutex.Lock() - defer consensus.mutex.Unlock() - if err != nil || - len(lastCommits) < bls.BLSSignatureSizeInBytes { - msgs := consensus.FBFTLog().GetMessagesByTypeSeq( + if err != nil || len(lastCommits) < bls.BLSSignatureSizeInBytes { + consensus.mutex.Lock() + defer consensus.mutex.Unlock() + msgs := consensus.fBFTLog.GetMessagesByTypeSeq( msg_pb.MessageType_COMMITTED, blockNum, ) if len(msgs) != 1 {