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

Remove redundant vote processing of piggybacked vote #62

Merged
merged 2 commits into from
Jan 29, 2025
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
7 changes: 3 additions & 4 deletions epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ func (e *Epoch) createBlockVerificationTask(block Block, from NodeID, vote Vote)
}
round.votes[string(vote.Signature.Signer)] = &vote

if err := e.doProposed(block, vote, from); err != nil {
if err := e.doProposed(block); err != nil {
e.Logger.Warn("Failed voting on block", zap.Error(err))
}

Expand Down Expand Up @@ -1237,7 +1237,7 @@ func (e *Epoch) startRound() error {
return e.handleBlockMessage(msgsForRound.proposal, leaderForCurrentRound)
}

func (e *Epoch) doProposed(block Block, voteFromLeader Vote, from NodeID) error {
func (e *Epoch) doProposed(block Block) error {
vote, err := e.voteOnBlock(block)
if err != nil {
return err
Expand All @@ -1260,8 +1260,7 @@ func (e *Epoch) doProposed(block Block, voteFromLeader Vote, from NodeID) error
if err := e.handleVoteMessage(&vote, e.ID); err != nil {
return err
}

return e.handleVoteMessage(&voteFromLeader, e.ID)
return nil
}

func (e *Epoch) voteOnBlock(block Block) (Vote, error) {
Expand Down
4 changes: 4 additions & 0 deletions epoch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func notarizeAndFinalizeRound(t *testing.T, nodes []NodeID, round uint64, e *Epo

// start at one since our node has already voted
for i := 1; i < quorum; i++ {
// Skip the vote of the block proposer
if leader.Equals(nodes[i]) {
continue
}
injectTestVote(t, e, block, nodes[i])
}

Expand Down