GetVote converts the CommitSig for the given valIdx to a Vote. Returns nil if the precommit at valIdx is nil. Panics if valIdx >= commit.Size().
(valIdx int32)
| 782 | // Returns nil if the precommit at valIdx is nil. |
| 783 | // Panics if valIdx >= commit.Size(). |
| 784 | func (commit *Commit) GetVote(valIdx int32) *Vote { |
| 785 | commitSig := commit.Signatures[valIdx] |
| 786 | return &Vote{ |
| 787 | Type: tmproto.PrecommitType, |
| 788 | Height: commit.Height, |
| 789 | Round: commit.Round, |
| 790 | BlockID: commitSig.BlockID(commit.BlockID), |
| 791 | Timestamp: commitSig.Timestamp, |
| 792 | ValidatorAddress: commitSig.ValidatorAddress, |
| 793 | ValidatorIndex: valIdx, |
| 794 | Signature: commitSig.Signature, |
| 795 | } |
| 796 | } |
| 797 | |
| 798 | // VoteSignBytes returns the bytes of the Vote corresponding to valIdx for |
| 799 | // signing. |