Skip to content

Commit

Permalink
Chnages: vote structure rectification
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilpune committed Jan 10, 2024
1 parent 437eb87 commit b07d500
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion types/canonical.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ func CanonicalizeProposal(chainID string, proposal *tmproto.Proposal) tmproto.Ca
// CanonicalizeVote transforms the given Vote to a CanonicalVote, which does
// not contain ValidatorIndex and ValidatorAddress fields.
func CanonicalizeVote(chainID string, vote *tmproto.Vote) tmproto.CanonicalVote {

canonicalSideTxResults := make([]tmproto.VoteSideTxResult, len(vote.SideTxResults))
for i, result := range vote.SideTxResults {
if result != nil {
canonicalSideTxResults[i] = *result // Dereference the pointer
} else {
// Handle the nil case if necessary
canonicalSideTxResults[i] = tmproto.VoteSideTxResult{} // Or some default value
}
}

return tmproto.CanonicalVote{
Type: vote.Type,
Height: vote.Height, // encoded as sfixed64
Expand All @@ -62,7 +73,7 @@ func CanonicalizeVote(chainID string, vote *tmproto.Vote) tmproto.CanonicalVote
Timestamp: vote.Timestamp,
ChainID: chainID,

SideTxResults: vote.SideTxResults,
SideTxResults: canonicalSideTxResults,
}
}

Expand Down

0 comments on commit b07d500

Please sign in to comment.