validators

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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 NewValidator(pubKey types.Pubkey, absentTimes *types.BitArray, totalStake *big.Int, accumReward *big.Int, isDirty bool, isTotalStakeDirty bool, isAccumRewardDirty bool, bus *bus.Bus) *Validator

func (*Validator) AddAccumReward

func (v *Validator) AddAccumReward(amount *big.Int)

func (*Validator) CountAbsentTimes

func (v *Validator) CountAbsentTimes() int

func (*Validator) GetAccumReward

func (v *Validator) GetAccumReward() *big.Int

func (*Validator) GetAddress

func (v *Validator) GetAddress() types.TmAddress

GetAddress returns tendermint-address of a validator

func (*Validator) GetTotalBipStake

func (v *Validator) GetTotalBipStake() *big.Int

GetTotalBipStake returns total bip stake

func (*Validator) IsToDrop

func (v *Validator) IsToDrop() bool

func (*Validator) SetAbsent

func (v *Validator) SetAbsent(height uint64)

func (*Validator) SetAccumReward

func (v *Validator) SetAccumReward(value *big.Int)

func (*Validator) SetPresent

func (v *Validator) SetPresent(height uint64)

func (*Validator) SetTotalBipStake

func (v *Validator) SetTotalBipStake(value *big.Int)

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

func NewValidators(bus *bus.Bus, iavl tree.MTree) (*Validators, error)

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

Jump to

Keyboard shortcuts

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