Documentation ¶
Index ¶
- type RValidators
- type Validator
- func (v *Validator) AddAccumReward(amount *big.Int)
- func (v *Validator) CountAbsentTimes() int
- func (v *Validator) GetAccumReward() *big.Int
- func (v *Validator) GetAddress() types.TmAddress
- func (v *Validator) GetTotalBipStake() *big.Int
- func (v *Validator) IsToDrop() bool
- func (v *Validator) SetAbsent(height uint64)
- func (v *Validator) SetAccumReward(value *big.Int)
- func (v *Validator) SetPresent(height uint64)
- func (v *Validator) SetTotalBipStake(value *big.Int)
- type Validators
- func (v *Validators) Commit() error
- func (v *Validators) Create(pubkey types.Pubkey, stake *big.Int)
- func (v *Validators) Export(state *types.AppState)
- func (v *Validators) GetByPublicKey(pubKey types.Pubkey) *Validator
- func (v *Validators) GetByTmAddress(address types.TmAddress) *Validator
- func (v *Validators) GetValidators() []*Validator
- func (v *Validators) LoadValidators()
- func (v *Validators) PayRewards(height uint64)
- func (v *Validators) PunishByzantineValidator(tmAddress [20]byte)
- func (v *Validators) SetNewValidators(candidates []candidates.Candidate)
- func (v *Validators) SetToDrop(pubkey types.Pubkey)
- func (v *Validators) SetValidatorAbsent(height uint64, address types.TmAddress)
- func (v *Validators) SetValidatorPresent(height uint64, address types.TmAddress)
- func (v *Validators) SetValidators(vals []*Validator)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RValidators ¶ added in v1.2.0
type RValidators interface { GetValidators() []*Validator Export(state *types.AppState) GetByPublicKey(pubKey types.Pubkey) *Validator LoadValidators() GetByTmAddress(address types.TmAddress) *Validator }
RValidators interface represents Validator state
type Validator ¶
type Validator struct { PubKey types.Pubkey AbsentTimes *types.BitArray // contains filtered or unexported fields }
func NewValidator ¶
func (*Validator) AddAccumReward ¶
func (*Validator) CountAbsentTimes ¶
func (*Validator) GetAccumReward ¶
func (*Validator) GetAddress ¶
GetAddress returns tendermint-address of a validator
func (*Validator) GetTotalBipStake ¶
GetTotalBipStake returns total bip stake
func (*Validator) SetAccumReward ¶
func (*Validator) SetPresent ¶
func (*Validator) SetTotalBipStake ¶
SetTotalBipStake sets total bip stake
type Validators ¶
type Validators struct {
// contains filtered or unexported fields
}
Validators struct is a store of Validators state
func NewValidators ¶
NewValidators returns newly created Validators state with a given bus and iavl
func (*Validators) Commit ¶
func (v *Validators) Commit() error
Commit writes changes to iavl, may return an error
func (*Validators) Create ¶
func (v *Validators) Create(pubkey types.Pubkey, stake *big.Int)
Create creates a new validator with given params and adds it to state
func (*Validators) Export ¶
func (v *Validators) Export(state *types.AppState)
Export exports all data to the given state
func (*Validators) GetByPublicKey ¶ added in v1.1.6
func (v *Validators) GetByPublicKey(pubKey types.Pubkey) *Validator
GetByPublicKey finds and returns validator
func (*Validators) GetByTmAddress ¶ added in v1.1.6
func (v *Validators) GetByTmAddress(address types.TmAddress) *Validator
GetByTmAddress finds and returns validator with given tendermint-address
func (*Validators) GetValidators ¶
func (v *Validators) GetValidators() []*Validator
GetValidators returns list of validators
func (*Validators) LoadValidators ¶
func (v *Validators) LoadValidators()
LoadValidators loads only list of validators (for read)
func (*Validators) PayRewards ¶
func (v *Validators) PayRewards(height uint64)
PayRewards distributes accumulated rewards between validator, delegators, DAO and developers addresses
func (*Validators) PunishByzantineValidator ¶
func (v *Validators) PunishByzantineValidator(tmAddress [20]byte)
PunishByzantineValidator find validator with given tmAddress and punishes it: 1. Set total stake 0 2. Drop validator
func (*Validators) SetNewValidators ¶
func (v *Validators) SetNewValidators(candidates []candidates.Candidate)
SetNewValidators updated validators list with new candidates
func (*Validators) SetToDrop ¶
func (v *Validators) SetToDrop(pubkey types.Pubkey)
SetToDrop marks given validator as inactive for dropping it in the next block
func (*Validators) SetValidatorAbsent ¶
func (v *Validators) SetValidatorAbsent(height uint64, address types.TmAddress)
SetValidatorAbsent marks validator as absent at current height if validator misses signs of more than validatorMaxAbsentTimes, it will receive penalty and will be swithed off
func (*Validators) SetValidatorPresent ¶
func (v *Validators) SetValidatorPresent(height uint64, address types.TmAddress)
SetValidatorPresent marks validator as present at current height
func (*Validators) SetValidators ¶
func (v *Validators) SetValidators(vals []*Validator)
SetValidators updates validators list