tdpos

package
v0.0.0-...-56f3d1a Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MAXSLEEPTIME        = 1000
	MAXMAPSIZE          = 1000
	MAXHISPROPOSERSSIZE = 100

	NOMINATETYPE = "nominate"
	VOTETYPE     = "vote"
)

Variables

View Source
var (
	ErrInvalidProposer  = errors.New("invalid proposer")
	ErrTimeoutBlock     = errors.New("new block is out of date")
	ErrHeightTooLow     = errors.New("target height is lower than 4")
	ErrNominateAddr     = errors.New("addr in nominate candidate tx can not be empty")
	ErrVoteNominate     = errors.New("addr in vote candidate hasn't been nominated")
	ErrAmount           = errors.New("amount in contract can not be empty")
	ErrAuth             = errors.New("candidate has not authenticated your submission")
	ErrRepeatNominate   = errors.New("candidate had been nominate")
	ErrEmptyNominateKey = errors.New("no valid candidate key when revoke")
	ErrValueNotFound    = errors.New("value not found, please check your input parameters")
	ErrSchedule         = errors.New("minerScheduling overflow")
	ErrNotFound         = errors.New("Key not found")
)

Functions

func NewNominateValue

func NewNominateValue() nominateValue

func NewRevokeValue

func NewRevokeValue() revokeValue

func NewSchedule

func NewSchedule(xconfig *tdposConfig, log logs.Logger, ledger cctx.LedgerRely, startHeight int64) *tdposSchedule

NewSchedule 新建schedule实例

func NewvoteValue

func NewvoteValue() voteValue

func ParseConsensusStorage

func ParseConsensusStorage(block cctx.BlockInterface) (interface{}, error)

Types

type TdposStatus

type TdposStatus struct {
	Name        string
	Version     int64 `json:"version"`
	StartHeight int64 `json:"startHeight"`
	Index       int   `json:"index"`
	// contains filtered or unexported fields
}

tdposStatus 实现了ConsensusStatus接口

func (*TdposStatus) GetConsensusBeginInfo

func (t *TdposStatus) GetConsensusBeginInfo() int64

func (*TdposStatus) GetConsensusName

func (t *TdposStatus) GetConsensusName() string

获取共识类型

func (*TdposStatus) GetCurrentTerm

func (t *TdposStatus) GetCurrentTerm() int64

获取当前状态机term

func (*TdposStatus) GetCurrentValidatorsInfo

func (t *TdposStatus) GetCurrentValidatorsInfo() []byte

获取当前矿工信息

func (*TdposStatus) GetStepConsensusIndex

func (t *TdposStatus) GetStepConsensusIndex() int

获取共识item所在consensus slice中的index

func (*TdposStatus) GetVersion

func (t *TdposStatus) GetVersion() int64

获取共识版本号

type ValidatorsInfo

type ValidatorsInfo struct {
	Validators   []string `json:"validators"`
	Miner        string   `json:"miner"`
	Curterm      int64    `json:"curterm"`
	ContractInfo string   `json:"contract"`
}

Jump to

Keyboard shortcuts

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