MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / GetVote

Method GetVote

types/block.go:784–796  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

782// Returns nil if the precommit at valIdx is nil.
783// Panics if valIdx >= commit.Size().
784func (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.

Callers 4

VoteSignBytesMethod · 0.95
GetByIndexMethod · 0.95
TestCommitToVoteSetFunction · 0.45
CommitToVoteSetFunction · 0.45

Calls 1

BlockIDMethod · 0.45

Tested by 1

TestCommitToVoteSetFunction · 0.36