Skip to content

Commit

Permalink
fix locks
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusKysel committed Oct 30, 2024
1 parent e1511c3 commit be1f16f
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ std::shared_ptr<PillarBlock> PillarChainManager::createPillarBlock(
void PillarChainManager::saveNewPillarBlock(const std::shared_ptr<PillarBlock>& pillar_block,
std::vector<state_api::ValidatorVoteCount>&& new_vote_counts) {
db_->saveCurrentPillarBlockData({pillar_block, new_vote_counts});

std::scoped_lock<std::shared_mutex> lock(mutex_);
current_pillar_block_ = pillar_block;
current_pillar_block_vote_counts_ = std::move(new_vote_counts);
{
std::scoped_lock<std::shared_mutex> lock(mutex_);
current_pillar_block_ = pillar_block;
current_pillar_block_vote_counts_ = std::move(new_vote_counts);
}
}

std::shared_ptr<PillarVote> PillarChainManager::genAndPlacePillarVote(PbftPeriod period,
Expand Down Expand Up @@ -332,7 +333,6 @@ bool PillarChainManager::isValidPillarBlock(const std::shared_ptr<PillarBlock>&
}

const auto last_finalized_pillar_block = getLastFinalizedPillarBlock();
std::shared_lock<std::shared_mutex> lock(mutex_);
assert(last_finalized_pillar_block);

// Check if some block was not skipped
Expand Down

0 comments on commit be1f16f

Please sign in to comment.