types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DefaultCodeSpace btypes.CodespaceType = "stake"

	CodeInvalidInput                     btypes.CodeType = 501 // 输入有误
	CodeOwnerNoEnoughToken               btypes.CodeType = 503 // Owner账户Tokens不足
	CodeValidatorExists                  btypes.CodeType = 504 // Validator已存在
	CodeConsensusHasValidator            btypes.CodeType = 505 // Owner已绑定有Validator
	CodeValidatorNotExists               btypes.CodeType = 506 // Validator不存在
	CodeErrCommissionNegative            btypes.CodeType = 510 // Negative commission
	CodeErrCommissionHuge                btypes.CodeType = 511 // Commission too large
	CodeErrCommissionGTMaxRate           btypes.CodeType = 512 // Commission cannot be more than the max rate
	CodeErrCommissionChangeRateNegative  btypes.CodeType = 513 // Commission change rate must be positive
	CodeErrCommissionChangeRateGTMaxRate btypes.CodeType = 514 // Commission change rate cannot be more than the max rate
	CodeErrCommissionUpdateTime          btypes.CodeType = 515 // Commission cannot be changed more than once in 24h
	CodeErrCommissionGTMaxChangeRate     btypes.CodeType = 516 // Commission cannot be changed more than max change rate
	CoderErrOwnerNotMatch                btypes.CodeType = 517 // validator owner不匹配
)

stake errors reserve 500 ~ 599.

View Source
const (
	AddrLen = 20

	MapperName = "validator"

	//------query-------
	Stake         = "stake"
	Delegation    = "delegation"
	Delegations   = "delegations"
	ValidatorFlag = "validator"
	Delegator     = "delegator"
	Unbondings    = "Unbondings"
	Redelegations = "Redelegations"
)
View Source
const (
	//Active 可获得挖矿奖励状态
	Active int8 = iota

	//Inactive
	Inactive

	//Inactive Code
	Revoke        InactiveCode = iota // 2
	MissVoteBlock                     // 3
	MaxValidator                      // 4
	DoubleSign                        // 5
)

Variables

View Source
var (
	// 事件类型
	EventTypeCreateValidator   = "create-validator"   // 创建验证节点
	EventTypeModifyValidator   = "modify-validator"   // 修改验证节点
	EventTypeRevokeValidator   = "revoke-validator"   // 撤销验证节点
	EventTypeActiveValidator   = "active-validator"   // 激活验证节点
	EventTypeInactiveValidator = "inactive-validator" // 失活验证节点
	EventTypeCloseValidator    = "close-validator"    // 关闭验证节点

	EventTypeCreateDelegation   = "create-delegation"   // 创建委托
	EventTypeModifyCompound     = "modify-compound"     // 修改委托
	EventTypeUnbondDelegation   = "unbond-delegation"   // 取消委托
	EventTypeCreateReDelegation = "create-redelegation" // 转委托

	EventTypeMissingVote = "missing-vote" // 未参与投票

	EventTypeSlash = "slash" // 惩罚

	// 事件参数
	AttributeKeyModule       = "stake"         // 模块名称
	AttributeKeyHeight       = "height"        // 高度
	AttributeKeyValidator    = "validator"     // 验证节点
	AttributeKeyNewValidator = "new-validator" // 转委托目标验证节点
	AttributeKeyOwner        = "owner"         // 验证节点持有账户
	AttributeKeyDelegator    = "delegator"     // 委托账户
	AttributeKeyTokens       = "tokens"        // 质押量
	AttributeKeyReason       = "reason"        // 惩罚原因
	AttributeKeyMissedBlocks = "missed-blocks" // 漏块数

	// 常量
	AttributeValueDoubleSign = "double_sign" // 双签
	AttributeValueDownTime   = "down_time"   // 漏块
)
View Source
var (
	DelegationByDelValKey = []byte{0x31} // key: delegator add + validator OperatorAddress add, value: delegationInfo
	DelegationByValDelKey = []byte{0x32} // key: OperatorAddress owner add + delegator add, value: nil

	UnbondingHeightDelegatorValidatorKey = []byte{0x41} // key: height + delegator + validator OperatorAddress addr, value: UnbondingDelegationInfo
	UnbondingDelegatorHeightValidatorKey = []byte{0x42} // key: delegator + height + validator OperatorAddress addr, value: nil
	UnbondingValidatorHeightDelegatorKey = []byte{0x43} // key: validator + height + delegator add, value: nil

	RedelegationHeightDelegatorFromValidatorKey = []byte{0x51} // key: height + delegator + fromValidator add, value: redelegations going to be complete on this height
	RedelegationDelegatorHeightFromValidatorKey = []byte{0x52} // key: delegator + height + fromValidator add, value: nil
	RedelegationFromValidatorHeightDelegatorKey = []byte{0x53} // key: fromValidator + height + delegator add, value: nil

)
View Source
var (
	ParamSpace = "stake"

	// keys for stake parameters
	KeyMaxValidatorCnt             = []byte("max_validator_cnt")
	KeyValidatorVotingStatusLen    = []byte("voting_status_len")
	KeyValidatorVotingStatusLeast  = []byte("voting_status_least")
	KeyValidatorSurvivalSecs       = []byte("survival_secs")
	KeyDelegatorUnbondFrozenHeight = []byte("unbond_frozen_height")
	KeyMaxEvidenceAge              = []byte("max_evidence_age")
	KeySlashFractionDoubleSign     = []byte("slash_fraction_double_sign")
	KeySlashFractionDowntime       = []byte("slash_fraction_downtime")
)
View Source
var PowerReduction = btypes.OneInt()

验证节点绑定QOS与共识权重换算, 1 voting power = 1 bond tokens

Functions

func BuildCurrentValidatorsAddressKey

func BuildCurrentValidatorsAddressKey() []byte

func BuildDelegationByDelValKey

func BuildDelegationByDelValKey(delAdd btypes.AccAddress, valAdd btypes.ValAddress) []byte

func BuildDelegationByValDelKey

func BuildDelegationByValDelKey(valAdd btypes.ValAddress, delAdd btypes.AccAddress) []byte

func BuildDelegationByValidatorPrefix

func BuildDelegationByValidatorPrefix(valAdd btypes.ValAddress) []byte

func BuildGetDelegationCustomQueryPath

func BuildGetDelegationCustomQueryPath(deleAddr btypes.AccAddress, valAddr btypes.ValAddress) string

func BuildInactiveValidatorKey

func BuildInactiveValidatorKey(sec int64, valAddress btypes.ValAddress) []byte

func BuildInactiveValidatorKeyByTime

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

func BuildQueryDelegationsByDelegatorCustomQueryPath

func BuildQueryDelegationsByDelegatorCustomQueryPath(deleAddr btypes.AccAddress) string

func BuildQueryDelegationsByOwnerCustomQueryPath

func BuildQueryDelegationsByOwnerCustomQueryPath(valAddr btypes.ValAddress) string

func BuildQueryRedelegationsByDelegatorCustomQueryPath

func BuildQueryRedelegationsByDelegatorCustomQueryPath(deleAddr btypes.AccAddress) string

func BuildQueryUnbondingsByDelegatorCustomQueryPath

func BuildQueryUnbondingsByDelegatorCustomQueryPath(deleAddr btypes.AccAddress) string

func BuildRedelegationByDelegatorPrefix

func BuildRedelegationByDelegatorPrefix(delAddr btypes.AccAddress) []byte

func BuildRedelegationByFromValidatorPrefix

func BuildRedelegationByFromValidatorPrefix(valAddr btypes.ValAddress) []byte

func BuildRedelegationByHeightPrefix

func BuildRedelegationByHeightPrefix(height int64) []byte

func BuildRedelegationDelegatorHeightFromValidatorKey

func BuildRedelegationDelegatorHeightFromValidatorKey(delAddr btypes.AccAddress, height int64, valAddr btypes.ValAddress) []byte

func BuildRedelegationFromValidatorHeightDelegatorKey

func BuildRedelegationFromValidatorHeightDelegatorKey(valAddr btypes.ValAddress, height int64, delAddr btypes.AccAddress) []byte

func BuildRedelegationHeightDelegatorFromValidatorKey

func BuildRedelegationHeightDelegatorFromValidatorKey(height int64, delAdd btypes.AccAddress, valAddr btypes.ValAddress) []byte

func BuildStakeStoreQueryPath

func BuildStakeStoreQueryPath() []byte

func BuildUnbondingByDelegatorPrefix

func BuildUnbondingByDelegatorPrefix(delAddr btypes.AccAddress) []byte

func BuildUnbondingByValidatorPrefix

func BuildUnbondingByValidatorPrefix(valAddr btypes.ValAddress) []byte

func BuildUnbondingDelegationByHeightPrefix

func BuildUnbondingDelegationByHeightPrefix(height int64) []byte

func BuildUnbondingDelegatorHeightValidatorKey

func BuildUnbondingDelegatorHeightValidatorKey(delAddr btypes.AccAddress, height int64, valAddr btypes.ValAddress) []byte

func BuildUnbondingHeightDelegatorValidatorKey

func BuildUnbondingHeightDelegatorValidatorKey(height int64, deleAddr btypes.AccAddress, valAddr btypes.ValAddress) []byte

func BuildUnbondingValidatorHeightDelegatorKey

func BuildUnbondingValidatorHeightDelegatorKey(valAddr btypes.ValAddress, height int64, delAddr btypes.AccAddress) []byte

func BuildValidatorByConsensusKey added in v0.0.8

func BuildValidatorByConsensusKey(consensusAddress btypes.ConsAddress) []byte

func BuildValidatorByVotePower

func BuildValidatorByVotePower(votePower int64, valAddress btypes.ValAddress) []byte

func BuildValidatorKey

func BuildValidatorKey(valAddress btypes.ValAddress) []byte

func BuildValidatorPrefixKey added in v0.0.8

func BuildValidatorPrefixKey() []byte

func BuildValidatorVoteInfoInWindowKey

func BuildValidatorVoteInfoInWindowKey(index int64, valAddress btypes.ValAddress) []byte

func BuildValidatorVoteInfoInWindowPrefixKey

func BuildValidatorVoteInfoInWindowPrefixKey(valAddress btypes.ValAddress) []byte

func BuildValidatorVoteInfoKey

func BuildValidatorVoteInfoKey(valAddress btypes.ValAddress) []byte

func ErrCommissionChangeRateGTMaxRate

func ErrCommissionChangeRateGTMaxRate() btypes.Error

func ErrCommissionChangeRateNegative

func ErrCommissionChangeRateNegative() btypes.Error

func ErrCommissionGTMaxChangeRate

func ErrCommissionGTMaxChangeRate() btypes.Error

func ErrCommissionGTMaxRate

func ErrCommissionGTMaxRate() btypes.Error

func ErrCommissionHuge

func ErrCommissionHuge() btypes.Error

func ErrCommissionNegative

func ErrCommissionNegative() btypes.Error

func ErrCommissionUpdateTime

func ErrCommissionUpdateTime() btypes.Error

func ErrConsensusHasValidator added in v0.0.8

func ErrConsensusHasValidator() btypes.Error

func ErrInvalidInput

func ErrInvalidInput(msg string) btypes.Error

func ErrOwnerNoEnoughToken

func ErrOwnerNoEnoughToken() btypes.Error

func ErrOwnerNotMatch added in v0.0.8

func ErrOwnerNotMatch() btypes.Error

func ErrValidatorExists

func ErrValidatorExists() btypes.Error

func ErrValidatorNotExists

func ErrValidatorNotExists() btypes.Error

func GetDelegationValDelKeyAddress

func GetDelegationValDelKeyAddress(key []byte) (valAddr btypes.ValAddress, deleAddr btypes.AccAddress)

func GetRedelegationDelegatorHeightFromValidator

func GetRedelegationDelegatorHeightFromValidator(key []byte) (deleAddr btypes.AccAddress, height int64, valAddr btypes.ValAddress)

func GetRedelegationFromValidatorHeightDelegator

func GetRedelegationFromValidatorHeightDelegator(key []byte) (valAddr btypes.ValAddress, height int64, deleAddr btypes.AccAddress)

func GetRedelegationHeightDelegatorFromValidator

func GetRedelegationHeightDelegatorFromValidator(key []byte) (height int64, deleAddr btypes.AccAddress, valAddr btypes.ValAddress)

func GetUnbondingDelegationDelegatorHeightValidator

func GetUnbondingDelegationDelegatorHeightValidator(key []byte) (deleAddr btypes.AccAddress, height int64, valAddr btypes.ValAddress)

func GetUnbondingDelegationHeightDelegatorValidator

func GetUnbondingDelegationHeightDelegatorValidator(key []byte) (height int64, deleAddr btypes.AccAddress, valAddr btypes.ValAddress)

func GetUnbondingDelegationValidatorHeightDelegator

func GetUnbondingDelegationValidatorHeightDelegator(key []byte) (valAddr btypes.ValAddress, height int64, deleAddr btypes.AccAddress)

func GetValidatorByInactiveKey

func GetValidatorByInactiveKey() []byte

func GetValidatorByVotePowerKey

func GetValidatorByVotePowerKey() []byte

func GetValidatorVoteInfoAddr

func GetValidatorVoteInfoAddr(key []byte) btypes.ValAddress

func GetValidatorVoteInfoInWindowIndexAddr

func GetValidatorVoteInfoInWindowIndexAddr(key []byte) (int64, btypes.ValAddress)

func GetValidatorVoteInfoInWindowKey

func GetValidatorVoteInfoInWindowKey() []byte

func GetValidatorVoteInfoKey

func GetValidatorVoteInfoKey() []byte

func ParseValidatorVotePowerKey added in v0.0.8

func ParseValidatorVotePowerKey(key []byte) (votePower int64, valAddress btypes.ValAddress, err error)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

Types

type Commission

type Commission struct {
	CommissionRates `json:"commission_rates" yaml:"commission_rates"`
	UpdateTime      time.Time `json:"update_time"` // the last time the commission rate was changed
}

Commission defines a commission parameters for a given validator.

func NewCommission

func NewCommission(rate, maxRate, maxChangeRate qtypes.Dec) Commission

NewCommission returns an initialized validator commission.

func NewCommissionWithTime

func NewCommissionWithTime(rate, maxRate, maxChangeRate qtypes.Dec, updatedAt time.Time) Commission

NewCommission returns an initialized validator commission with a specified update time which should be the current block BFT time.

func (Commission) Equal

func (c Commission) Equal(c2 Commission) bool

Equal checks if the given Commission object is equal to the receiving Commission object.

func (Commission) String

func (c Commission) String() string

String implements the Stringer interface for a Commission.

func (Commission) ValidateNewRate

func (c Commission) ValidateNewRate(newRate qtypes.Dec, blockTime time.Time) btypes.Error

ValidateNewRate performs basic sanity validation checks of a new commission rate. If validation fails, an SDK error is returned.

type CommissionRates

type CommissionRates struct {
	Rate          qtypes.Dec `json:"rate"`            // the commission rate charged to delegators, as a fraction
	MaxRate       qtypes.Dec `json:"max_rate"`        // maximum commission rate which validator can ever charge, as a fraction
	MaxChangeRate qtypes.Dec `json:"max_change_rate"` // maximum daily increase of the validator commission, as a fraction
}

CommissionRates defines the initial commission rates to be used for creating a validator.

func NewCommissionRates

func NewCommissionRates(rate, maxRate, maxChangeRate qtypes.Dec) CommissionRates

NewCommissionRates returns an initialized validator commission rates.

func (CommissionRates) Validate

func (c CommissionRates) Validate() btypes.Error

Validate performs basic sanity validation checks of initial commission parameters. If validation fails, an SDK error is returned.

type DelegationInfo

type DelegationInfo struct {
	DelegatorAddr btypes.AccAddress `json:"delegator_addr"`
	ValidatorAddr btypes.ValAddress `json:"validator_addr"`
	Amount        btypes.BigInt     `json:"delegate_amount"` // 委托数量
	IsCompound    bool              `json:"is_compound"`     // 是否复投
}

func NewDelegationInfo

func NewDelegationInfo(deleAddr btypes.AccAddress, valAddr btypes.ValAddress, amount btypes.BigInt, isCompound bool) DelegationInfo

type DelegationInfoState

type DelegationInfoState struct {
	DelegatorAddr btypes.AccAddress `json:"delegator_addr"`
	ValidatorAddr btypes.ValAddress `json:"validator_addr"`
	Amount        btypes.BigInt     `json:"delegate_amount"`
	IsCompound    bool              `json:"is_compound"`
}

type Description

type Description struct {
	Moniker string `json:"moniker"` // name
	Website string `json:"website"` // optional website link
	Details string `json:"details"` // optional details
}

Description - description fields for a validator

type GenesisState

type GenesisState struct {
	GenTxs                 []txs.TxStd                      `json:"gen_txs"`               // signed TxCreateValidator in genesis.json
	Params                 Params                           `json:"params"`                // stake module parameters
	Validators             []Validator                      `json:"validators"`            // validatorKey, validatorByOwnerKey,validatorByInactiveKey,validatorByVotePowerKey
	ValidatorsVoteInfo     []ValidatorVoteInfoState         `json:"val_votes_info"`        // validatorVoteInfoKey
	ValidatorsVoteInWindow []ValidatorVoteInWindowInfoState `json:"val_votes_in_window"`   // validatorVoteInfoInWindowKey
	DelegatorsInfo         []DelegationInfoState            `json:"delegators_info"`       // DelegationByDelValKey, DelegationByValDelKey
	DelegatorsUnbondInfo   []UnbondingDelegationInfo        `json:"delegator_unbond_info"` // UnbondingHeightDelegatorKey
	ReDelegationsInfo      []RedelegationInfo               `json:"redelegations_info"`    // ReDelegationHeightDelegatorKey
	CurrentValidators      []Validator                      `json:"current_validators"`    // currentValidatorsAddressKey
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(params Params,
	validators []Validator,
	validatorsVoteInfo []ValidatorVoteInfoState,
	validatorsVoteInWindow []ValidatorVoteInWindowInfoState,
	delegatorsInfo []DelegationInfoState,
	delegatorsUnbondInfo []UnbondingDelegationInfo,
	reDelegationsInfo []RedelegationInfo,
	currentValidators []Validator) GenesisState

type Hooks

type Hooks interface {
	// 创建完验证节点后执行操作
	AfterValidatorCreated(ctx context.Context, val btypes.ValAddress)

	// 验证节点删除之前操作
	BeforeValidatorRemoved(ctx context.Context, val btypes.ValAddress)

	// 委托创建之后操作
	AfterDelegationCreated(ctx context.Context, val btypes.ValAddress, del btypes.AccAddress)

	// 修改委托之前操作
	BeforeDelegationModified(ctx context.Context, val btypes.ValAddress, del btypes.AccAddress, updateTokes btypes.BigInt)

	// 验证节点惩罚之后操作
	AfterValidatorSlashed(ctx context.Context, slashedTokes btypes.BigInt)
}

为解决gov和stake循环依赖问题,引入Hooks接口,stake mapper初始化时注入hooks distribution 实现

type InactiveCode

type InactiveCode int8

type Params

type Params struct {
	MaxValidatorCnt             int64         `json:"max_validator_cnt"`          // 最多验证节点数量
	ValidatorVotingStatusLen    int64         `json:"voting_status_len"`          // 投票窗口高度
	ValidatorVotingStatusLeast  int64         `json:"voting_status_least"`        // 最低投票高度
	ValidatorSurvivalSecs       int64         `json:"survival_secs"`              // inactive状态验证节点状态保持时间
	DelegatorUnbondFrozenHeight int64         `json:"unbond_frozen_height"`       // 解委托token锁定高度
	MaxEvidenceAge              time.Duration `json:"max_evidence_age"`           // 证据数据有效时长
	SlashFractionDoubleSign     types.Dec     `json:"slash_fraction_double_sign"` // 双签惩罚比例
	SlashFractionDowntime       types.Dec     `json:"slash_fraction_downtime"`    // 漏块惩罚比例
}

func DefaultParams

func DefaultParams() Params

func NewParams

func NewParams(maxValidatorCnt, validatorVotingStatusLen, validatorVotingStatusLeast, validatorSurvivalSecs,
	delegatorUnbondFrozenHeight int64, maxEvidenceAge time.Duration,
	slashFractionDoubleSign types.Dec, slashFractionDowntime types.Dec) Params

func (*Params) GetParamSpace

func (p *Params) GetParamSpace() string

参数模块名称

func (*Params) KeyValuePairs

func (p *Params) KeyValuePairs() qtypes.KeyValuePairs

func (*Params) SetKeyValue added in v0.0.8

func (p *Params) SetKeyValue(key string, value interface{}) btypes.Error

设置单个参数值,针对不同数据类型做不同处理

func (*Params) Validate

func (p *Params) Validate() btypes.Error

参数校验

func (*Params) ValidateKeyValue added in v0.0.8

func (p *Params) ValidateKeyValue(key string, value string) (interface{}, btypes.Error)

校验单个参数,并返回参数数值

type RedelegationInfo

type RedelegationInfo struct {
	DelegatorAddr  btypes.AccAddress `json:"delegator_addr"`
	FromValidator  btypes.ValAddress `json:"from_validator"`
	ToValidator    btypes.ValAddress `json:"to_validator"`
	Amount         btypes.BigInt     `json:"delegate_amount"`
	Height         int64             `json:"height"`
	CompleteHeight int64             `json:"complete_height"`
	IsCompound     bool              `json:"is_compound"` // 是否复投
}

re delegate

func NewRedelegateInfo

func NewRedelegateInfo(deleAddr btypes.AccAddress, fromValAddr, toValAddr btypes.ValAddress, amount btypes.BigInt, height, completeHeight int64, isCompound bool) RedelegationInfo

type UnbondingDelegationInfo

type UnbondingDelegationInfo struct {
	DelegatorAddr  btypes.AccAddress `json:"delegator_addr"`
	ValidatorAddr  btypes.ValAddress `json:"validator_addr"`
	Height         int64             `json:"height"`
	CompleteHeight int64             `json:"complete_height"`
	Amount         btypes.BigInt     `json:"delegate_amount"`
}

unbond

func NewUnbondingDelegationInfo

func NewUnbondingDelegationInfo(deleAddr btypes.AccAddress, valAddr btypes.ValAddress, height, completeHeight int64, amount btypes.BigInt) UnbondingDelegationInfo

type Validator

type Validator struct {
	OperatorAddress btypes.ValAddress `json:"validator_address"`
	Owner           btypes.AccAddress `json:"owner"`
	ConsPubKey      crypto.PubKey     `json:"consensus_pubkey"`
	BondTokens      btypes.BigInt     `json:"bond_tokens"`
	Description     Description       `json:"description"`
	Commission      Commission        `json:"commission"`

	Status         int8         `json:"status"`
	InactiveCode   InactiveCode `json:"inactive_code"`
	InactiveTime   time.Time    `json:"inactive_time"`
	InactiveHeight int64        `json:"inactive_height"`

	MinPeriod  int64 `json:"min_period"`
	BondHeight int64 `json:"bond_height"`
}

func (Validator) ConsAddress added in v0.0.8

func (val Validator) ConsAddress() btypes.ConsAddress

func (Validator) ConsensusPower added in v0.0.8

func (val Validator) ConsensusPower() int64

func (Validator) GetBondTokens

func (val Validator) GetBondTokens() btypes.BigInt

func (Validator) GetConsensusPubKey added in v0.0.8

func (val Validator) GetConsensusPubKey() crypto.PubKey

func (Validator) GetOwner

func (val Validator) GetOwner() btypes.AccAddress

func (Validator) GetValidatorAddress

func (val Validator) GetValidatorAddress() btypes.ValAddress

func (Validator) IsActive

func (val Validator) IsActive() bool

func (Validator) MarshalJSON added in v0.0.8

func (val Validator) MarshalJSON() ([]byte, error)

func (Validator) ToABCIValidator

func (val Validator) ToABCIValidator() (abciVal abci.Validator)

func (Validator) ToABCIValidatorUpdate

func (val Validator) ToABCIValidatorUpdate(isRemoved bool) (abciVal abci.ValidatorUpdate)

func (*Validator) UnmarshalJSON added in v0.0.8

func (val *Validator) UnmarshalJSON(data []byte) error

type ValidatorVoteInWindowInfoState

type ValidatorVoteInWindowInfoState struct {
	ValidatorAddr btypes.ValAddress `json:"validator_addr"`
	Index         int64             `json:"index"`
	Vote          bool              `json:"vote"`
}

type ValidatorVoteInfo

type ValidatorVoteInfo struct {
	StartHeight         int64 `json:"start_height"`
	IndexOffset         int64 `json:"index_offset"` //统计截止高度=StartHeight+IndexOffset-1
	MissedBlocksCounter int64 `json:"missed_blocks_counter"`
}

func NewValidatorVoteInfo

func NewValidatorVoteInfo(startHeight, indexOffset, missedBlocksCounter int64) ValidatorVoteInfo

type ValidatorVoteInfoState

type ValidatorVoteInfoState struct {
	ValidatorAddr btypes.ValAddress `json:"validator_addr"`
	VoteInfo      ValidatorVoteInfo `json:"vote_info"`
}

Jump to

Keyboard shortcuts

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