From 84bb8155833a03056ff47b583d221a88acdc2db3 Mon Sep 17 00:00:00 2001 From: Jeremiah Andrews Date: Wed, 8 Aug 2018 15:27:00 -0700 Subject: [PATCH] Filter votes with non-majority2/3 BlockID from Commit --- types/vote_set.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/vote_set.go b/types/vote_set.go index 02466ec08..00a1f25c3 100644 --- a/types/vote_set.go +++ b/types/vote_set.go @@ -539,13 +539,14 @@ func (voteSet *VoteSet) MakeCommit() *Commit { if voteSet.maj23 == nil { cmn.PanicSanity("Cannot MakeCommit() unless a blockhash has +2/3") } + blockID := *voteSet.maj23 // For every validator, get the precommit votesCopy := make([]*Vote, len(voteSet.votes)) copy(votesCopy, voteSet.votes) precommits := make([]*CommitSig, len(voteSet.votes)) for i, v := range votesCopy { - if v != nil { + if v != nil && v.BlockID.Equals(blockID) { precommits[i] = &CommitSig{ Signature: v.Signature, Timestamp: v.Timestamp, @@ -553,7 +554,7 @@ func (voteSet *VoteSet) MakeCommit() *Commit { } } return &Commit{ - BlockID: *voteSet.maj23, + BlockID: blockID, Precommits: precommits, RoundNum: voteSet.round, HeightNum: voteSet.height,