voteset

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 23, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 NewCPDecidedVoteSet(round int16, totalPower int64,
	validators map[crypto.Address]*validator.Validator,
) *BinaryVoteSet

func NewCPMainVoteVoteSet added in v0.15.0

func NewCPMainVoteVoteSet(round int16, totalPower int64,
	validators map[crypto.Address]*validator.Validator,
) *BinaryVoteSet

func NewCPPreVoteVoteSet added in v0.15.0

func NewCPPreVoteVoteSet(round int16, totalPower int64,
	validators map[crypto.Address]*validator.Validator,
) *BinaryVoteSet

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 (vs *BinaryVoteSet) BinaryVotes(cpRound int16, cpValue vote.CPValue) map[crypto.Address]*vote.Vote

func (*BinaryVoteSet) GetRandomVote added in v0.15.0

func (vs *BinaryVoteSet) GetRandomVote(cpRound int16, cpValue vote.CPValue) *vote.Vote

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

func (BinaryVoteSet) Round added in v0.15.0

func (vs BinaryVoteSet) Round() int16

Round returns the round number for the VoteSet.

type BlockVoteSet added in v0.15.0

type BlockVoteSet struct {
	// contains filtered or unexported fields
}

func NewPrecommitVoteSet added in v0.15.0

func NewPrecommitVoteSet(round int16, totalPower int64,
	validators map[crypto.Address]*validator.Validator,
) *BlockVoteSet

func NewPrepareVoteSet added in v0.15.0

func NewPrepareVoteSet(round int16, totalPower int64,
	validators map[crypto.Address]*validator.Validator,
) *BlockVoteSet

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 (vs *BlockVoteSet) BlockVotes(blockHash hash.Hash) map[crypto.Address]*vote.Vote

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.

func (BlockVoteSet) Round added in v0.15.0

func (vs BlockVoteSet) Round() int16

Round returns the round number for the VoteSet.

type IneligibleVoterError added in v1.5.0

type IneligibleVoterError struct {
	Address crypto.Address
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL