validator

package
v2.14.14 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const UnbondBlockCount = 518400

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

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

func NewRepository

func NewRepository(db *pg.DB, logger *logrus.Entry) *Repository

func (*Repository) AddPk

func (r *Repository) AddPk(id uint, pk string) error

func (*Repository) AddUnbond

func (r *Repository) AddUnbond(unbond *models.Unbond) error

func (*Repository) DeleteFromWaitList

func (r *Repository) DeleteFromWaitList(addressId, validatorId uint, coins []uint64) error

func (*Repository) DeleteStakesByValidatorIds

func (r *Repository) DeleteStakesByValidatorIds(idList []uint64) error

func (*Repository) DeleteStakesNotInListIds

func (r *Repository) DeleteStakesNotInListIds(idList []uint64) error

func (*Repository) FindIdByPk

func (r *Repository) FindIdByPk(pk string) (uint, error)

Find validator with public key. Return Validator ID

func (*Repository) FindIdByPkOrCreate

func (r *Repository) FindIdByPkOrCreate(pk string) (uint, error)

Find validator with public key or create if not exist. Return Validator ID

func (*Repository) FindPkId

func (r *Repository) FindPkId(pk string) (uint, error)

func (*Repository) GetById

func (r *Repository) GetById(id uint) (*models.Validator, error)

func (*Repository) RemoveFromWaitList

func (r *Repository) RemoveFromWaitList(addressId, validatorId uint) error

func (*Repository) ResetAllStatuses

func (r *Repository) ResetAllStatuses() error

func (*Repository) SaveAllIfNotExist

func (r *Repository) SaveAllIfNotExist(validators map[string]struct{}) error

Save list of validators if not exist

func (*Repository) SaveAllStakes

func (r *Repository) SaveAllStakes(stakes []*models.Stake) error

func (*Repository) SaveBan added in v2.12.0

func (r *Repository) SaveBan(ban *models.ValidatorBan) error

func (*Repository) Update

func (r *Repository) Update(validator *models.Validator) error

func (*Repository) UpdateAll

func (r *Repository) UpdateAll(validators []*models.Validator) error

func (*Repository) UpdateStake

func (r *Repository) UpdateStake(s *models.Stake) error

func (*Repository) UpdateStakes added in v2.12.7

func (r *Repository) UpdateStakes(list []*models.Stake) error

type Service

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

func NewService

func NewService(env *env.ExtenderEnvironment, nodeApi *grpc_client.Client, repository *Repository, addressRepository *address.Repository, coinRepository *coin.Repository, logger *logrus.Entry) *Service

func (*Service) GetStakesFromCandidateResponse

func (s *Service) GetStakesFromCandidateResponse(response *api_pb.CandidateResponse) ([]*models.Stake, error)

func (*Service) GetUnbondSaverJobChannel

func (s *Service) GetUnbondSaverJobChannel() chan *models.Transaction

func (*Service) GetUpdateStakesJobChannel

func (s *Service) GetUpdateStakesJobChannel() chan int

func (*Service) GetUpdateValidatorsJobChannel

func (s *Service) GetUpdateValidatorsJobChannel() chan int

func (*Service) GetUpdateWaitListJobChannel

func (s *Service) GetUpdateWaitListJobChannel() chan *models.Transaction

func (*Service) HandleBlockResponse

func (s *Service) HandleBlockResponse(response *api_pb.BlockResponse) error

Get validators PK from response and store it to validators table if not exist

func (*Service) HandleCandidateResponse

func (s *Service) HandleCandidateResponse(response *api_pb.CandidateResponse) (*models.Validator, []*models.Stake, error)

func (*Service) SetChasingMode

func (s *Service) SetChasingMode(chasingMode bool)

func (*Service) UnbondSaverWorker

func (s *Service) UnbondSaverWorker(data <-chan *models.Transaction)

func (*Service) UpdateStakesWorker

func (s *Service) UpdateStakesWorker(jobs <-chan int)

func (*Service) UpdateValidatorsWorker

func (s *Service) UpdateValidatorsWorker(jobs <-chan int)

func (*Service) UpdateWaitList

func (s *Service) UpdateWaitList(adr, pk string) error

func (*Service) UpdateWaitListWorker

func (s *Service) UpdateWaitListWorker(data <-chan *models.Transaction)

Jump to

Keyboard shortcuts

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