Skip to content

Commit

Permalink
rework move semantics little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusKysel committed Oct 29, 2024
1 parent 409ac0b commit 1a7373c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class PillarChainManager {
* @param pillar_block
* @param new_vote_counts
*/
void saveNewPillarBlock(std::shared_ptr<PillarBlock> pillar_block,
void saveNewPillarBlock(std::shared_ptr<PillarBlock>& pillar_block,
std::vector<state_api::ValidatorVoteCount>&& new_vote_counts);

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,13 @@ std::shared_ptr<PillarBlock> PillarChainManager::createPillarBlock(
return pillar_block;
}

void PillarChainManager::saveNewPillarBlock(std::shared_ptr<PillarBlock> pillar_block,
void PillarChainManager::saveNewPillarBlock(std::shared_ptr<PillarBlock>& pillar_block,
std::vector<state_api::ValidatorVoteCount>&& new_vote_counts) {
CurrentPillarBlockDataDb data{std::move(pillar_block), std::move(new_vote_counts)};
db_->saveCurrentPillarBlockData(data);
db_->saveCurrentPillarBlockData({pillar_block, new_vote_counts});

std::scoped_lock<std::shared_mutex> lock(mutex_);
current_pillar_block_ = std::move(data.pillar_block);
current_pillar_block_vote_counts_ = std::move(data.vote_counts);
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

0 comments on commit 1a7373c

Please sign in to comment.