Skip to content

Commit

Permalink
unused checks
Browse files Browse the repository at this point in the history
  • Loading branch information
samliok committed Feb 26, 2025
1 parent db5e4c9 commit 80223b9
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions epoch.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ func (e *Epoch) handleVoteMessage(message *Vote, from NodeID) error {
return nil
}

if !e.isVoteValid(vote) {
return nil
}

// If we have not received the proposal yet, we won't have a Round object in e.rounds,
// yet we may receive the corresponding vote.
// This may happen if we're asynchronously verifying the proposal at the moment.
Expand Down Expand Up @@ -661,10 +665,6 @@ func (e *Epoch) handleVoteMessage(message *Vote, from NodeID) error {
return nil
}

if !e.isVoteValid(vote) {
return nil
}

// Only verify the vote if we haven't verified it in the past.
signature := message.Signature
if _, exists := round.votes[string(signature.Signer)]; !exists {
Expand Down Expand Up @@ -1099,20 +1099,6 @@ func (e *Epoch) handleNotarizationMessage(message *Notarization, from NodeID) er
e.Logger.Verbo("Received notarization message",
zap.Stringer("from", from), zap.Uint64("round", vote.Round))

// Ignore votes for previous rounds
if vote.Round < e.round {
e.Logger.Debug("Received a notarization for an earlier round", zap.Uint64("round", vote.Round))
return nil
}

// Ignore votes for rounds too far ahead
if e.isRoundTooFarAhead(vote.Round) {
e.Logger.Debug("Received a notarization for a too advanced round",
zap.Uint64("round", vote.Round), zap.Uint64("my round", e.round),
zap.Stringer("NodeID", from))
return nil
}

if !e.isVoteValid(vote) {
e.Logger.Debug("Notarization contains invalid vote",
zap.Stringer("NodeID", from))
Expand Down

0 comments on commit 80223b9

Please sign in to comment.