Skip to content

Commit

Permalink
chore: just fix to make testnet runing
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusKysel committed Mar 17, 2023
1 parent 1500374 commit 8ba3efd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ std::optional<addr_t> RewardsStats::getTransactionValidator(const trx_hash_t& tx
bool RewardsStats::addVote(const std::shared_ptr<Vote>& vote) {
// Set valid cert vote to validator
auto& validator_stats = validators_stats_[vote->getVoterAddr()];
assert(validator_stats.vote_weight_ == 0);
// assert(validator_stats.vote_weight_ == 0);
assert(vote->getWeight());

if (validator_stats.vote_weight_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ std::pair<bool, std::string> ExtVotesPacketHandler::validateVotePeriodRoundStep(
checking_round = 1;
}

// vote->getRound() == checking_round - 1 && next_vote -> previous round next vote
// vote->gtRound() == checking_round - 1 && next_vote -> previous round next vote
if (vote->getRound() < checking_round - 1 ||
(vote->getRound() == checking_round - 1 && vote->getType() != PbftVoteTypes::next_vote)) {
return {false, "Invalid round(too small): " + genErrMsg(vote)};
Expand Down Expand Up @@ -162,6 +162,14 @@ bool ExtVotesPacketHandler::validateVoteAndBlock(const std::shared_ptr<Vote> &vo
<< pbft_block->getBlockHash();
return false;
}
std::unordered_set<vote_hash_t> set;
const auto reward_votes = pbft_block->getRewardVotes();
set.reserve(reward_votes.size());
for (const auto &hash : reward_votes) {
if (!set.insert(hash).second) {
LOG(log_er_) << "PBFT block " << pbft_block->getBlockHash() << " has duplicated vote " << hash;
}
}

return true;
}
Expand Down

0 comments on commit 8ba3efd

Please sign in to comment.