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 commit processing #1436

Merged
merged 3 commits into from
Dec 5, 2022
Merged

Fix commit processing #1436

merged 3 commits into from
Dec 5, 2022

Conversation

xDimon
Copy link
Member

@xDimon xDimon commented Dec 4, 2022

Referenced issues

No provided

Description of the Change

Justification creates now with minimal enough weight and all equivocations.
Fixed commit processing

Signed-off-by: Dmitriy Khaustov aka xDimon <[email protected]>
@xDimon xDimon enabled auto-merge (squash) December 4, 2022 16:22
Signed-off-by: Dmitriy Khaustov aka xDimon <[email protected]>
VoteWeight::Weight weight = 0;

// Collect equivocations first (until threshold is reached)
result = std::accumulate(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May simplify

Suggested change
result = std::accumulate(
for (auto &vote : votes) {
if (weight >= threshold_) break;
if (auto equivocatory_voting_message = boost::get<EquivocatorySignedMessage>(&vote)) {

auto &signed_precommit =
static_cast<const SignedPrecommit &>(voting_message);
weight +=
voter_set_->voterWeight(signed_precommit.id).value();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check before calling .value()?

@xDimon xDimon merged commit 2c93358 into master Dec 5, 2022
@xDimon xDimon deleted the fix/grandpa branch December 5, 2022 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants