Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SignatureVote ¶
type Singer ¶
type Singer struct {
// contains filtered or unexported fields
}
func NewSinger ¶
func NewSinger(privKey *ecdsa.PrivateKey) *Singer
type Validator ¶
type Validator struct { ID uint32 `json:"id"` Address hash.Address `json:"address"` PubKey *ecdsa.PublicKey `json:"pub_key"` Accum int64 `json:"accum"` }
Volatile state for each Validator NOTE: The Accum is not included in Validator.Hash(); make sure to update that method if changes are made here
type ValidatorSet ¶
type ValidatorSet struct { // NOTE: persisted via reflect, must be exported. Validators []*Validator `json:"validators"` Proposer *Validator `json:"proposer"` // contains filtered or unexported fields }
ValidatorSet represent a set of *Validator at a given height. The validators can be fetched by address or index. The index is in order of .Address, so the indices are fixed for all rounds of a given blockchain height. On the other hand, the .AccumPower of each validator and the designated .GetProposer() of a set changes every round, upon calling .IncrementAccum(). NOTE: Not goroutine-safe. NOTE: All get/set to validators should copy the value for safety.
func NewValidatorSet ¶
func NewValidatorSet(pubkList [][]byte) (*ValidatorSet, error)
func (*ValidatorSet) GetByAddress ¶
func (vs *ValidatorSet) GetByAddress(address hash.Address) *Validator
func (*ValidatorSet) GetProposer ¶
func (vs *ValidatorSet) GetProposer(height, round uint64) *Validator
GetProposer returns the current proposer. If the validator set is empty, nil is returned.
type ValidatorsSort ¶
type ValidatorsSort []*Validator
Sort validators by address
func (ValidatorsSort) Len ¶
func (v ValidatorsSort) Len() int
func (ValidatorsSort) Less ¶
func (v ValidatorsSort) Less(i, j int) bool
func (ValidatorsSort) Swap ¶
func (v ValidatorsSort) Swap(i, j int)
type VoteSet ¶
type VoteSet struct {
// contains filtered or unexported fields
}
func NewVoteSet ¶
func NewVoteSet(height, round uint64, valSet *ValidatorSet) *VoteSet