staking

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValidatorMapperName = "validator"
)
View Source
const (
	VoteInfoMapperName = "voteInfo"
)

Variables

This section is empty.

Functions

func BeginBlocker

func BeginBlocker(ctx context.Context, req abci.RequestBeginBlock)

1. 统计validator投票信息, 将不活跃的validator转成Inactive状态

func BuildCurrentValidatorAddressKey

func BuildCurrentValidatorAddressKey() []byte

func BuildInactiveValidatorKey

func BuildInactiveValidatorKey(sec uint64, valAddress btypes.Address) []byte

func BuildInactiveValidatorKeyByTime

func BuildInactiveValidatorKeyByTime(inactiveTime time.Time, valAddress btypes.Address) []byte

func BuildOwnerWithValidatorKey

func BuildOwnerWithValidatorKey(ownerAddress btypes.Address) []byte

func BuildValidatorByVotePower

func BuildValidatorByVotePower(votePower uint64, valAddress btypes.Address) []byte

func BuildValidatorKey

func BuildValidatorKey(valAddress btypes.Address) []byte

func BuildValidatorStoreQueryPath

func BuildValidatorStoreQueryPath() []byte

func BuildValidatorVoteInfoInWindowKey

func BuildValidatorVoteInfoInWindowKey(index uint64, valAddress btypes.Address) []byte

func BuildValidatorVoteInfoKey

func BuildValidatorVoteInfoKey(valAddress btypes.Address) []byte

func BuildVoteInfoStoreQueryPath

func BuildVoteInfoStoreQueryPath() []byte

func BulidValidatorPrefixKey

func BulidValidatorPrefixKey() []byte

func EndBlocker

func EndBlocker(ctx context.Context) (res abci.ResponseEndBlock)

1. 将所有Inactive到一定期限的validator删除 2. 统计新的validator

func GetUpdatedValidators

func GetUpdatedValidators(ctx context.Context, maxValidatorCount uint64) []abci.Validator

func RegisterCodec

func RegisterCodec(cdc *amino.Codec)

Types

type TxActiveValidator

type TxActiveValidator struct {
	Owner btypes.Address //操作者
}

func NewActiveValidatorTx

func NewActiveValidatorTx(owner btypes.Address) *TxActiveValidator

func (*TxActiveValidator) CalcGas

func (tx *TxActiveValidator) CalcGas() btypes.BigInt

func (*TxActiveValidator) Exec

func (tx *TxActiveValidator) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)

func (*TxActiveValidator) GetGasPayer

func (tx *TxActiveValidator) GetGasPayer() btypes.Address

func (*TxActiveValidator) GetSignData

func (tx *TxActiveValidator) GetSignData() (ret []byte)

func (*TxActiveValidator) GetSigner

func (tx *TxActiveValidator) GetSigner() []btypes.Address

func (*TxActiveValidator) ValidateData

func (tx *TxActiveValidator) ValidateData(ctx context.Context) error

type TxCreateValidator

type TxCreateValidator struct {
	Name        string
	Owner       btypes.Address //操作者
	PubKey      crypto.PubKey  //validator公钥
	BondTokens  uint64         //绑定Token数量
	Description string
}

func NewCreateValidatorTx

func NewCreateValidatorTx(name string, owner btypes.Address, pubKey crypto.PubKey, bondTokens uint64, description string) *TxCreateValidator

func (*TxCreateValidator) CalcGas

func (tx *TxCreateValidator) CalcGas() btypes.BigInt

func (*TxCreateValidator) Exec

func (tx *TxCreateValidator) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)

func (*TxCreateValidator) GetGasPayer

func (tx *TxCreateValidator) GetGasPayer() btypes.Address

func (*TxCreateValidator) GetSignData

func (tx *TxCreateValidator) GetSignData() (ret []byte)

func (*TxCreateValidator) GetSigner

func (tx *TxCreateValidator) GetSigner() []btypes.Address

func (*TxCreateValidator) ValidateData

func (tx *TxCreateValidator) ValidateData(ctx context.Context) error

type TxRevokeValidator

type TxRevokeValidator struct {
	Owner btypes.Address //操作者
}

func NewRevokeValidatorTx

func NewRevokeValidatorTx(owner btypes.Address) *TxRevokeValidator

func (*TxRevokeValidator) CalcGas

func (tx *TxRevokeValidator) CalcGas() btypes.BigInt

func (*TxRevokeValidator) Exec

func (tx *TxRevokeValidator) Exec(ctx context.Context) (result btypes.Result, crossTxQcp *txs.TxQcp)

func (*TxRevokeValidator) GetGasPayer

func (tx *TxRevokeValidator) GetGasPayer() btypes.Address

func (*TxRevokeValidator) GetSignData

func (tx *TxRevokeValidator) GetSignData() (ret []byte)

func (*TxRevokeValidator) GetSigner

func (tx *TxRevokeValidator) GetSigner() []btypes.Address

func (*TxRevokeValidator) ValidateData

func (tx *TxRevokeValidator) ValidateData(ctx context.Context) error

type ValidatorMapper

type ValidatorMapper struct {
	*mapper.BaseMapper
}

func GetValidatorMapper

func GetValidatorMapper(ctx context.Context) *ValidatorMapper

func NewValidatorMapper

func NewValidatorMapper() *ValidatorMapper

func (*ValidatorMapper) Copy

func (mapper *ValidatorMapper) Copy() mapper.IMapper

func (*ValidatorMapper) CreateValidator

func (mapper *ValidatorMapper) CreateValidator(validator types.Validator)

func (*ValidatorMapper) Exists

func (mapper *ValidatorMapper) Exists(valAddress btypes.Address) bool

func (*ValidatorMapper) ExistsWithOwner

func (mapper *ValidatorMapper) ExistsWithOwner(owner btypes.Address) bool

func (*ValidatorMapper) GetValidator

func (mapper *ValidatorMapper) GetValidator(valAddress btypes.Address) (validator types.Validator, exsits bool)

func (*ValidatorMapper) GetValidatorByOwner

func (mapper *ValidatorMapper) GetValidatorByOwner(owner btypes.Address) (validator types.Validator, exsits bool)

func (*ValidatorMapper) IteratorInactiveValidator

func (mapper *ValidatorMapper) IteratorInactiveValidator(fromSecond, endSecond uint64) store.Iterator

func (*ValidatorMapper) IteratorInactiveValidatorByTime

func (mapper *ValidatorMapper) IteratorInactiveValidatorByTime(fromTime, endTime time.Time) store.Iterator

func (*ValidatorMapper) IteratorValidatrorByVoterPower

func (mapper *ValidatorMapper) IteratorValidatrorByVoterPower(ascending bool) store.Iterator

func (*ValidatorMapper) KickValidator

func (mapper *ValidatorMapper) KickValidator(valAddress btypes.Address) (validator types.Validator, ok bool)

func (*ValidatorMapper) MakeValidatorActive

func (mapper *ValidatorMapper) MakeValidatorActive(valAddress btypes.Address)

func (*ValidatorMapper) MakeValidatorInactive

func (mapper *ValidatorMapper) MakeValidatorInactive(valAddress btypes.Address, inactiveHeight uint64, inactiveTime time.Time, code types.InactiveCode)

type VoteInfoMapper

type VoteInfoMapper struct {
	*mapper.BaseMapper
}

func GetVoteInfoMapper

func GetVoteInfoMapper(ctx context.Context) *VoteInfoMapper

func NewVoteInfoMapper

func NewVoteInfoMapper() *VoteInfoMapper

func (*VoteInfoMapper) ClearValidatorVoteInfoInWindow

func (mapper *VoteInfoMapper) ClearValidatorVoteInfoInWindow(valAddr btypes.Address)

func (*VoteInfoMapper) Copy

func (mapper *VoteInfoMapper) Copy() mapper.IMapper

func (*VoteInfoMapper) DelValidatorVoteInfo

func (mapper *VoteInfoMapper) DelValidatorVoteInfo(valAddr btypes.Address)

func (*VoteInfoMapper) GetValidatorVoteInfo

func (mapper *VoteInfoMapper) GetValidatorVoteInfo(valAddr btypes.Address) (VoteInfo types.ValidatorVoteInfo, exsits bool)

func (*VoteInfoMapper) GetVoteInfoInWindow

func (mapper *VoteInfoMapper) GetVoteInfoInWindow(valAddr btypes.Address, index uint64) (vote bool)

func (*VoteInfoMapper) ResetValidatorVoteInfo

func (mapper *VoteInfoMapper) ResetValidatorVoteInfo(valAddr btypes.Address, info types.ValidatorVoteInfo)

func (*VoteInfoMapper) SetValidatorVoteInfo

func (mapper *VoteInfoMapper) SetValidatorVoteInfo(valAddr btypes.Address, info types.ValidatorVoteInfo)

func (*VoteInfoMapper) SetVoteInfoInWindow

func (mapper *VoteInfoMapper) SetVoteInfoInWindow(valAddr btypes.Address, index uint64, vote bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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