Skip to content

Commit

Permalink
fix processVote return value check
Browse files Browse the repository at this point in the history
  • Loading branch information
JakubFornadel committed Mar 20, 2023
1 parent 1d2079e commit f9cbfdb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bool ExtVotesPacketHandler::processVote(const std::shared_ptr<Vote> &vote, const
return false;
}

// Validate vote's period, roun and step min/max values
// Validate vote's period, round and step min/max values
if (const auto vote_valid = validateVotePeriodRoundStep(vote, peer, validate_max_round_step); !vote_valid.first) {
LOG(log_wr_) << "Vote period/round/step " << vote->getHash() << " validation failed. Err: " << vote_valid.second;
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void VotePacketHandler::process(const PacketData &packet_data, const std::shared
peer->markPbftBlockAsKnown(pbft_block->getBlockHash());
}

if (processVote(vote, pbft_block, peer, true)) {
if (!processVote(vote, pbft_block, peer, true)) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,12 @@ void VotesSyncPacketHandler::process(const PacketData &packet_data, const std::s

// Process processStandardVote is called with false in case of next votes bundle -> does not check max boundaries
// for round and step to actually being able to sync the current round in case network is stalled
bool check_max_round_step = votes_bundle_votes_type == PbftVoteTypes::next_vote ? false : true;
if (processVote(vote, nullptr, peer, check_max_round_step)) {
bool check_max_round_step = true;
if (votes_bundle_votes_type == PbftVoteTypes::cert_vote || votes_bundle_votes_type == PbftVoteTypes::next_vote) {
check_max_round_step = false;
}

if (!processVote(vote, nullptr, peer, check_max_round_step)) {
continue;
}

Expand Down

0 comments on commit f9cbfdb

Please sign in to comment.