PrepareProposal-VoteExtension integration (#6915)

This commit is contained in:
mconcat
2021-11-16 13:23:48 +01:00
committed by Sergio Mena
parent d2afb91e99
commit 39ffa80ae7
8 changed files with 281 additions and 188 deletions

View File

@@ -518,7 +518,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

View File

@@ -326,6 +326,18 @@ func (vote *Vote) ToProto() *tmproto.Vote {
}
}
func VotesToProto(votes []*Vote) (res []*tmproto.Vote) {
if votes == nil {
return nil
}
res = make([]*tmproto.Vote, len(votes))
for i, vote := range votes {
res[i] = vote.ToProto()
}
return
}
func VoteExtensionFromProto(pext *tmproto.VoteExtension) VoteExtension {
ext := VoteExtension{}
if pext != nil {

View File

@@ -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(