mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-10 23:10:59 +00:00
types: Require vote extensions on non-nil precommits and not otherwise
Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
@@ -67,7 +67,7 @@ func TestMsgToProto(t *testing.T) {
|
||||
|
||||
pv := types.NewMockPV()
|
||||
vote, err := factory.MakeVote(ctx, pv, factory.DefaultTestChainID,
|
||||
0, 1, 0, 2, types.BlockID{}, time.Now())
|
||||
0, 1, 0, 2, bi, time.Now())
|
||||
require.NoError(t, err)
|
||||
pbVote := vote.ToProto()
|
||||
|
||||
|
||||
@@ -294,8 +294,10 @@ func (vote *Vote) ValidateBasic() error {
|
||||
return fmt.Errorf("signature is too big (max: %d)", MaxSignatureSize)
|
||||
}
|
||||
|
||||
// We should only ever see vote extensions in precommits.
|
||||
if vote.Type != tmproto.PrecommitType {
|
||||
// We should only ever see vote extensions in non-nil precommits, otherwise
|
||||
// this is a violation of the specification.
|
||||
// https://github.com/tendermint/tendermint/issues/8487
|
||||
if vote.Type != tmproto.PrecommitType || (vote.Type == tmproto.PrecommitType && vote.BlockID.IsNil()) {
|
||||
if len(vote.Extension) > 0 {
|
||||
return errors.New("unexpected vote extension")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user