mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 05:46:32 +00:00
Old PrepareProposal and vote extension integration on feature/abci++ppp (#9117)
* abci: PrepareProposal-VoteExtension integration [2nd try] (#7821) * PrepareProposal-VoteExtension integration (#6915) * make proto-gen * Fix protobuf crash in e2e nightly tests * Update types/vote.go Co-authored-by: M. J. Fromberger <fromberger@interchain.io> * Addressed @creachadair's comments Co-authored-by: mconcat <monoidconcat@gmail.com> Co-authored-by: M. J. Fromberger <fromberger@interchain.io> * Proto changes * make proto-gen * Fixed UTs * bump * lint * lint2 * lint3 * lint4 * lint5 * lint6 * no_lint Co-authored-by: mconcat <monoidconcat@gmail.com> Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
This commit is contained in:
@@ -509,7 +509,8 @@ func (h *Header) StringIndented(indent string) string {
|
||||
indent, h.LastResultsHash,
|
||||
indent, h.EvidenceHash,
|
||||
indent, h.ProposerAddress,
|
||||
indent, h.Hash())
|
||||
indent, h.Hash(),
|
||||
)
|
||||
}
|
||||
|
||||
// ToProto converts Header to protobuf
|
||||
|
||||
@@ -220,6 +220,22 @@ func (vote *Vote) ToProto() *tmproto.Vote {
|
||||
}
|
||||
}
|
||||
|
||||
func VotesToProto(votes []*Vote) []*tmproto.Vote {
|
||||
if votes == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
res := make([]*tmproto.Vote, 0, len(votes))
|
||||
for _, vote := range votes {
|
||||
v := vote.ToProto()
|
||||
// protobuf crashes when serializing "repeated" fields with nil elements
|
||||
if v != nil {
|
||||
res = append(res, v)
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// FromProto converts a proto generetad type to a handwritten type
|
||||
// return type, nil if everything converts safely, otherwise nil, error
|
||||
func VoteFromProto(pv *tmproto.Vote) (*Vote, error) {
|
||||
|
||||
@@ -226,6 +226,10 @@ func (voteSet *VoteSet) getVote(valIndex int32, blockKey string) (vote *Vote, ok
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func (voteSet *VoteSet) GetVotes() []*Vote {
|
||||
return voteSet.votes
|
||||
}
|
||||
|
||||
// Assumes signature is valid.
|
||||
// If conflicting vote exists, returns it.
|
||||
func (voteSet *VoteSet) addVerifiedVote(
|
||||
|
||||
Reference in New Issue
Block a user