mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-06 20:11:08 +00:00
add logic to propagate extended commits (#8433)
This commit is contained in:
@@ -381,8 +381,8 @@ func VotesToProto(votes []*Vote) []*tmproto.Vote {
|
||||
return res
|
||||
}
|
||||
|
||||
// FromProto converts a proto generetad type to a handwritten type
|
||||
// return type, nil if everything converts safely, otherwise nil, error
|
||||
// VoteFromProto attempts to convert the given serialization (Protobuf) type to
|
||||
// our Vote domain type. A basic validation check is also performed.
|
||||
func VoteFromProto(pv *tmproto.Vote) (*Vote, error) {
|
||||
if pv == nil {
|
||||
return nil, errors.New("nil vote")
|
||||
|
||||
@@ -2,6 +2,7 @@ package types
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@@ -213,8 +214,17 @@ func (voteSet *VoteSet) addVote(vote *Vote) (added bool, err error) {
|
||||
}
|
||||
|
||||
// Check signature.
|
||||
if err := vote.Verify(voteSet.chainID, val.PubKey); err != nil {
|
||||
return false, fmt.Errorf("failed to verify vote with ChainID %s and PubKey %s: %w", voteSet.chainID, val.PubKey, err)
|
||||
if voteSet.extensionsEnabled {
|
||||
if err := vote.VerifyVoteAndExtension(voteSet.chainID, val.PubKey); err != nil {
|
||||
return false, fmt.Errorf("failed to verify vote with ChainID %s and PubKey %s: %w", voteSet.chainID, val.PubKey, err)
|
||||
}
|
||||
} else {
|
||||
if err := vote.Verify(voteSet.chainID, val.PubKey); err != nil {
|
||||
return false, fmt.Errorf("failed to verify vote with ChainID %s and PubKey %s: %w", voteSet.chainID, val.PubKey, err)
|
||||
}
|
||||
if len(vote.ExtensionSignature) > 0 || len(vote.Extension) > 0 {
|
||||
return false, errors.New("unexpected vote extension data present in vote")
|
||||
}
|
||||
}
|
||||
|
||||
// Add vote and get conflicting vote if any.
|
||||
|
||||
Reference in New Issue
Block a user