Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix processVote return value check #2399

Merged
merged 1 commit into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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