diff --git a/libraries/core_libs/consensus/src/pillar_chain/pillar_chain_manager.cpp b/libraries/core_libs/consensus/src/pillar_chain/pillar_chain_manager.cpp index bd8257b977..1d58d7b03a 100644 --- a/libraries/core_libs/consensus/src/pillar_chain/pillar_chain_manager.cpp +++ b/libraries/core_libs/consensus/src/pillar_chain/pillar_chain_manager.cpp @@ -109,10 +109,11 @@ std::shared_ptr PillarChainManager::createPillarBlock( void PillarChainManager::saveNewPillarBlock(const std::shared_ptr& pillar_block, std::vector&& new_vote_counts) { db_->saveCurrentPillarBlockData({pillar_block, new_vote_counts}); - - std::scoped_lock lock(mutex_); - current_pillar_block_ = pillar_block; - current_pillar_block_vote_counts_ = std::move(new_vote_counts); + { + std::scoped_lock lock(mutex_); + current_pillar_block_ = pillar_block; + current_pillar_block_vote_counts_ = std::move(new_vote_counts); + } } std::shared_ptr PillarChainManager::genAndPlacePillarVote(PbftPeriod period, @@ -332,7 +333,6 @@ bool PillarChainManager::isValidPillarBlock(const std::shared_ptr& } const auto last_finalized_pillar_block = getLastFinalizedPillarBlock(); - std::shared_lock lock(mutex_); assert(last_finalized_pillar_block); // Check if some block was not skipped