Documentation ¶
Index ¶
- Variables
- type BinaryVoteSet
- func (vs *BinaryVoteSet) AddVote(vote *vote.Vote) (bool, error)
- func (vs *BinaryVoteSet) AllVotes() []*vote.Vote
- func (vs *BinaryVoteSet) BinaryVotes(cpRound int16, cpValue vote.CPValue) map[crypto.Address]*vote.Vote
- func (vs *BinaryVoteSet) GetRandomVote(cpRound int16, cpValue vote.CPValue) *vote.Vote
- func (vs *BinaryVoteSet) HasAllVotesFor(cpRound int16, cpValue vote.CPValue) bool
- func (vs *BinaryVoteSet) HasAnyVoteFor(cpRound int16, cpValue vote.CPValue) bool
- func (vs *BinaryVoteSet) HasOneThirdOfTotalPower(cpRound int16) bool
- func (vs *BinaryVoteSet) HasQuorumVotesFor(cpRound int16, cpValue vote.CPValue) bool
- func (vs *BinaryVoteSet) HasTwoThirdOfTotalPower(cpRound int16) bool
- func (vs BinaryVoteSet) Round() int16
- type BlockVoteSet
- func (vs *BlockVoteSet) AddVote(vote *vote.Vote) (bool, error)
- func (vs *BlockVoteSet) AllVotes() []*vote.Vote
- func (vs *BlockVoteSet) BlockVotes(blockHash hash.Hash) map[crypto.Address]*vote.Vote
- func (vs *BlockVoteSet) HasQuorumHash() bool
- func (vs *BlockVoteSet) QuorumHash() *hash.Hash
- func (vs BlockVoteSet) Round() int16
- type IneligibleVoterError
Constants ¶
This section is empty.
Variables ¶
var ErrDuplicatedVote = errors.New("duplicated vote")
ErrDuplicatedVote is returned when a duplicated vote from a validator is detected.
Functions ¶
This section is empty.
Types ¶
type BinaryVoteSet ¶ added in v0.15.0
type BinaryVoteSet struct {
// contains filtered or unexported fields
}
func NewCPDecidedVoteSet ¶ added in v1.2.0
func NewCPMainVoteVoteSet ¶ added in v0.15.0
func NewCPPreVoteVoteSet ¶ added in v0.15.0
func (*BinaryVoteSet) AddVote ¶ added in v0.15.0
func (vs *BinaryVoteSet) AddVote(vote *vote.Vote) (bool, error)
AddVote attempts to add a vote to the VoteSet. Returns an error if the vote is invalid.
func (*BinaryVoteSet) AllVotes ¶ added in v0.15.0
func (vs *BinaryVoteSet) AllVotes() []*vote.Vote
AllVotes returns a list of all votes in the VoteSet.
func (*BinaryVoteSet) BinaryVotes ¶ added in v0.15.0
func (*BinaryVoteSet) GetRandomVote ¶ added in v0.15.0
func (*BinaryVoteSet) HasAllVotesFor ¶ added in v0.15.0
func (vs *BinaryVoteSet) HasAllVotesFor(cpRound int16, cpValue vote.CPValue) bool
func (*BinaryVoteSet) HasAnyVoteFor ¶ added in v0.15.0
func (vs *BinaryVoteSet) HasAnyVoteFor(cpRound int16, cpValue vote.CPValue) bool
func (*BinaryVoteSet) HasOneThirdOfTotalPower ¶ added in v0.15.0
func (vs *BinaryVoteSet) HasOneThirdOfTotalPower(cpRound int16) bool
func (*BinaryVoteSet) HasQuorumVotesFor ¶ added in v0.15.0
func (vs *BinaryVoteSet) HasQuorumVotesFor(cpRound int16, cpValue vote.CPValue) bool
func (*BinaryVoteSet) HasTwoThirdOfTotalPower ¶ added in v0.15.0
func (vs *BinaryVoteSet) HasTwoThirdOfTotalPower(cpRound int16) bool
type BlockVoteSet ¶ added in v0.15.0
type BlockVoteSet struct {
// contains filtered or unexported fields
}
func NewPrecommitVoteSet ¶ added in v0.15.0
func NewPrepareVoteSet ¶ added in v0.15.0
func (*BlockVoteSet) AddVote ¶ added in v0.15.0
func (vs *BlockVoteSet) AddVote(vote *vote.Vote) (bool, error)
AddVote attempts to add a vote to the VoteSet. Returns an error if the vote is invalid.
func (*BlockVoteSet) AllVotes ¶ added in v0.15.0
func (vs *BlockVoteSet) AllVotes() []*vote.Vote
AllVotes returns a list of all votes in the VoteSet.
func (*BlockVoteSet) BlockVotes ¶ added in v0.15.0
func (*BlockVoteSet) HasQuorumHash ¶ added in v0.15.0
func (vs *BlockVoteSet) HasQuorumHash() bool
HasQuorumHash checks if there is a block that has received quorum votes (2/3+ of total power).
func (*BlockVoteSet) QuorumHash ¶ added in v0.15.0
func (vs *BlockVoteSet) QuorumHash() *hash.Hash
QuorumHash returns the hash of the block that has received quorum votes (2/3+ of total power). If no block has received the quorum threshold (2/3+ of total voting power), it returns nil.
type IneligibleVoterError ¶ added in v1.5.0
IneligibleVoterError is returned when the voter is not a member of the committee.
func (IneligibleVoterError) Error ¶ added in v1.5.0
func (e IneligibleVoterError) Error() string