dpos

package
v1.76.6 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: BSD-3-Clause Imports: 37 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dpos Uses nacl's secret_box to encrypt a net.Conn. It is (meant to be) an implementation of the STS protocol. Note we do not (yet) assume that a remote peer's pubkey is known ahead of time, and thus we are technically still vulnerable to MITM. (TODO!) See docs/sts-final.pdf for more info

Index

Constants

View Source
const (

	//VrfQueryTypeM vrf query type 为查询M信息
	VrfQueryTypeM = 0

	//VrfQueryTypeRP vrf query type 为查询RP信息
	VrfQueryTypeRP = 1
)
View Source
const (

	//ShuffleTypeNoVrf shuffle type: NoVrf, use default address order
	ShuffleTypeNoVrf = iota

	//ShuffleTypeVrf shuffle type: Vrf
	ShuffleTypeVrf

	//ShuffleTypePartVrf shuffle type: PartVrf
	ShuffleTypePartVrf
)
View Source
const DebugCatchup = false

DebugCatchup define whether catch up now

View Source
const (

	//MaxMsgPacketPayloadSize define
	MaxMsgPacketPayloadSize = 10 * 1024 * 1024
)

Variables

View Source
var (
	ErrInvalidVoteSignature      = errors.New("Error invalid vote signature")
	ErrInvalidVoteReplySignature = errors.New("Error invalid vote reply signature")
	ErrInvalidNotifySignature    = errors.New("Error invalid notify signature")
)

Errors define

View Source
var (
	// InitStateType 为状态机的初始状态
	InitStateType = 1
	// VotingStateType 为状态机的投票状态
	VotingStateType = 2
	// VotedStateType 为状态机的已投票状态
	VotedStateType = 3
	// WaitNotifyStateType 为状态机的等待通知状态
	WaitNotifyStateType = 4

	// StateTypeMapping 为状态的整型值和字符串值的对应关系
	StateTypeMapping = map[int]string{
		InitStateType:       "InitState",
		VotingStateType:     "VotingState",
		VotedStateType:      "VotedState",
		WaitNotifyStateType: "WaitNotifyState",
	}
)
View Source
var InitStateObj = &InitState{}

InitStateObj is the InitState obj

View Source
var LastCheckRegTopNTime = int64(0)

LastCheckRegTopNTime is the Last Check Reg TopN Time

View Source
var LastCheckUpdateTopNTime = int64(0)

LastCheckUpdateTopNTime is the Last Check Update TopN Time

View Source
var LastCheckVrfMTime = int64(0)

LastCheckVrfMTime is the Last Check Vrf M Time

View Source
var LastCheckVrfRPTime = int64(0)

LastCheckVrfRPTime is the Last Check Vrf RP Time

View Source
var VotedStateObj = &VotedState{}

VotedStateObj is the VotedState obj

View Source
var VotingStateObj = &VotingState{}

VotingStateObj is the VotingState obj

View Source
var WaitNotifyStateObj = &WaitNofifyState{}

WaitNotifyStateObj is the WaitNotifyState obj

Functions

func GenAddressByPubKey

func GenAddressByPubKey(pubkey crypto.PubKey) []byte

GenAddressByPubKey method

func New

func New(cfg *types.Consensus, sub []byte) queue.Module

New ...

func Parallel

func Parallel(tasks ...func())

Parallel method

Types

type Client

type Client struct {
	//config
	*drivers.BaseClient
	// contains filtered or unexported fields
}

Client Tendermint implementation

func (*Client) CheckBlock

func (client *Client) CheckBlock(parent *types.Block, current *types.BlockDetail) error

CheckBlock 暂不检查任何的交易

func (*Client) CheckTxDup

func (client *Client) CheckTxDup(txs []*types.Transaction, height int64) (transactions []*types.Transaction)

CheckTxDup check transactions that duplicate

func (*Client) Close

func (client *Client) Close()

Close TODO:may need optimize

func (*Client) CmpBestBlock

func (client *Client) CmpBestBlock(newBlock *types.Block, cmpBlock *types.Block) bool

CmpBestBlock 比较newBlock是不是最优区块

func (*Client) CreateBlock

func (client *Client) CreateBlock()

CreateBlock a routine monitor whether some transactions available and tell client by available channel

func (*Client) CreateGenesisTx

func (client *Client) CreateGenesisTx() (ret []*types.Transaction)

CreateGenesisTx ...

func (*Client) CreateRecordCBTx

func (client *Client) CreateRecordCBTx(info *dty.DposCBInfo) (tx *types.Transaction, err error)

CreateRecordCBTx create the tx to record cb

func (*Client) CreateRegVrfMTx

func (client *Client) CreateRegVrfMTx(info *dty.DposVrfMRegist) (tx *types.Transaction, err error)

CreateRegVrfMTx create the tx to regist Vrf M

func (*Client) CreateRegVrfRPTx

func (client *Client) CreateRegVrfRPTx(info *dty.DposVrfRPRegist) (tx *types.Transaction, err error)

CreateRegVrfRPTx create the tx to regist Vrf RP

func (*Client) CreateTopNRegistTx

func (client *Client) CreateTopNRegistTx(reg *dty.TopNCandidatorRegist) (tx *types.Transaction, err error)

CreateTopNRegistTx create tx to regist topN

func (*Client) GenesisDoc

func (client *Client) GenesisDoc() *ttypes.GenesisDoc

GenesisDoc returns the Node's GenesisDoc.

func (*Client) GetConsensusState

func (client *Client) GetConsensusState() *ConsensusState

GetConsensusState return the pointer to ConsensusState

func (*Client) GetGenesisBlockTime

func (client *Client) GetGenesisBlockTime() int64

GetGenesisBlockTime ...

func (*Client) GetNode

func (client *Client) GetNode() *Node

GetNode return the pointer to Node

func (*Client) PrivValidator

func (client *Client) PrivValidator() ttypes.PrivValidator

PrivValidator returns the Node's PrivValidator.

func (*Client) ProcEvent

func (client *Client) ProcEvent(msg *queue.Message) bool

ProcEvent ...

func (*Client) QueryCandidators

func (client *Client) QueryCandidators() ([]*dty.Candidator, error)

QueryCandidators query the topN candidators from blockchain

func (*Client) QueryTopNCandidators

func (client *Client) QueryTopNCandidators(version int64) (*dty.TopNCandidators, error)

QueryTopNCandidators method

func (*Client) QueryVrfInfos

func (client *Client) QueryVrfInfos(pubkeys [][]byte, cycle int64) ([]*dty.VrfInfo, error)

QueryVrfInfos query the vrf infos by pubkeys

func (*Client) SetBlockTime

func (client *Client) SetBlockTime(blockTime int64)

SetBlockTime set current block time to generate new block

func (*Client) SetQueueClient

func (client *Client) SetQueueClient(q queue.Client)

SetQueueClient ...

func (*Client) SetTestFlag

func (client *Client) SetTestFlag()

SetTestFlag set the test flag

func (*Client) StartConsensus

func (client *Client) StartConsensus()

StartConsensus a routine that make the consensus start

func (*Client) StopC

func (client *Client) StopC() <-chan struct{}

StopC stop client

func (*Client) ValidatorIndex

func (client *Client) ValidatorIndex() int

ValidatorIndex get the index of local this validator if it's

type ConsensusState

type ConsensusState struct {
	Quit chan struct{}
	// contains filtered or unexported fields
}

ConsensusState handles execution of the consensus algorithm.

func NewConsensusState

func NewConsensusState(client *Client, valMgr ValidatorMgr) *ConsensusState

NewConsensusState returns a new ConsensusState.

func (*ConsensusState) AddVotes

func (cs *ConsensusState) AddVotes(vote *dpostype.DPosVote)

AddVotes method

func (*ConsensusState) CacheNotify

func (cs *ConsensusState) CacheNotify(notify *dpostype.DPosNotify)

CacheNotify method

func (*ConsensusState) CacheVotes

func (cs *ConsensusState) CacheVotes(vote *dpostype.DPosVote)

CacheVotes method

func (*ConsensusState) CheckVotes

func (cs *ConsensusState) CheckVotes() (ty int, vote *dpostype.VoteItem)

CheckVotes method

func (*ConsensusState) ClearCachedNotify

func (cs *ConsensusState) ClearCachedNotify()

ClearCachedNotify method

func (*ConsensusState) ClearCachedVotes

func (cs *ConsensusState) ClearCachedVotes()

ClearCachedVotes method

func (*ConsensusState) ClearVotes

func (cs *ConsensusState) ClearVotes()

ClearVotes method

func (*ConsensusState) GetCBInfoByCircle

func (cs *ConsensusState) GetCBInfoByCircle(cycle int64) (info *dty.DposCBInfo)

GetCBInfoByCircle method

func (*ConsensusState) GetLastestTopNCandidators

func (cs *ConsensusState) GetLastestTopNCandidators() (info *dty.TopNCandidators)

GetLastestTopNCandidators method

func (*ConsensusState) GetPrivValidator

func (cs *ConsensusState) GetPrivValidator() ttypes.PrivValidator

GetPrivValidator returns the pointer of PrivValidator

func (*ConsensusState) GetTopNCandidatorsByVersion

func (cs *ConsensusState) GetTopNCandidatorsByVersion(version int64) (info *dty.TopNCandidators)

GetTopNCandidatorsByVersion method

func (*ConsensusState) GetValidatorMgr

func (cs *ConsensusState) GetValidatorMgr() ValidatorMgr

GetValidatorMgr returns a copy of the ValidatorMgr.

func (*ConsensusState) GetValidators

func (cs *ConsensusState) GetValidators() []*ttypes.Validator

GetValidators returns a copy of the current validators.

func (*ConsensusState) GetVrfInfoByCircle

func (cs *ConsensusState) GetVrfInfoByCircle(cycle int64, ty int) (info *dty.VrfInfo)

GetVrfInfoByCircle method

func (*ConsensusState) GetVrfInfosByCircle

func (cs *ConsensusState) GetVrfInfosByCircle(cycle int64) (infos []*dty.VrfInfo)

GetVrfInfosByCircle method

func (*ConsensusState) Init

func (cs *ConsensusState) Init()

Init method

func (*ConsensusState) InitCycleBoundaryInfo

func (cs *ConsensusState) InitCycleBoundaryInfo(task Task)

InitCycleBoundaryInfo method

func (*ConsensusState) InitCycleVrfInfo

func (cs *ConsensusState) InitCycleVrfInfo(task Task)

InitCycleVrfInfo method

func (*ConsensusState) InitCycleVrfInfos

func (cs *ConsensusState) InitCycleVrfInfos(task Task)

InitCycleVrfInfos method

func (*ConsensusState) InitTopNCandidators

func (cs *ConsensusState) InitTopNCandidators(version int64)

InitTopNCandidators method

func (*ConsensusState) IsInTopN

func (cs *ConsensusState) IsInTopN(info *dty.TopNCandidators) bool

IsInTopN method

func (*ConsensusState) IsProposer

func (cs *ConsensusState) IsProposer() bool

IsProposer method

func (*ConsensusState) IsRunning

func (cs *ConsensusState) IsRunning() bool

IsRunning method

func (*ConsensusState) IsTopNRegisted

func (cs *ConsensusState) IsTopNRegisted(info *dty.TopNCandidators) bool

IsTopNRegisted method

func (*ConsensusState) QueryCycleBoundaryInfo

func (cs *ConsensusState) QueryCycleBoundaryInfo(cycle int64) (*dty.DposCBInfo, error)

QueryCycleBoundaryInfo method

func (*ConsensusState) QueryVrf

func (cs *ConsensusState) QueryVrf(pubkey []byte, cycle int64) (info *dty.VrfInfo, err error)

QueryVrf method

func (*ConsensusState) QueryVrfs

func (cs *ConsensusState) QueryVrfs(set *ttypes.ValidatorSet, cycle int64) (infos []*dty.VrfInfo, err error)

QueryVrfs method

func (*ConsensusState) SaveMyVote

func (cs *ConsensusState) SaveMyVote()

SaveMyVote method

func (*ConsensusState) SaveNotify

func (cs *ConsensusState) SaveNotify()

SaveNotify method

func (*ConsensusState) SaveVote

func (cs *ConsensusState) SaveVote()

SaveVote method

func (*ConsensusState) SendCBTx

func (cs *ConsensusState) SendCBTx(info *dty.DposCBInfo) bool

SendCBTx method

func (*ConsensusState) SendRegistVrfMTx

func (cs *ConsensusState) SendRegistVrfMTx(info *dty.DposVrfMRegist) bool

SendRegistVrfMTx method

func (*ConsensusState) SendRegistVrfRPTx

func (cs *ConsensusState) SendRegistVrfRPTx(info *dty.DposVrfRPRegist) bool

SendRegistVrfRPTx method

func (*ConsensusState) SendTopNRegistTx

func (cs *ConsensusState) SendTopNRegistTx(reg *dty.TopNCandidatorRegist) bool

SendTopNRegistTx method

func (*ConsensusState) SetBroadcastChannel

func (cs *ConsensusState) SetBroadcastChannel(broadcastChannel chan<- MsgInfo)

SetBroadcastChannel method

func (*ConsensusState) SetCurrentVote

func (cs *ConsensusState) SetCurrentVote(vote *dpostype.VoteItem)

SetCurrentVote method

func (*ConsensusState) SetMyVote

func (cs *ConsensusState) SetMyVote(vote *dpostype.DPosVote)

SetMyVote method

func (*ConsensusState) SetNotify

func (cs *ConsensusState) SetNotify(notify *dpostype.DPosNotify)

SetNotify method

func (*ConsensusState) SetOurID

func (cs *ConsensusState) SetOurID(id ID)

SetOurID method

func (*ConsensusState) SetPrivValidator

func (cs *ConsensusState) SetPrivValidator(priv ttypes.PrivValidator, index int)

SetPrivValidator sets the private validator account for signing votes.

func (*ConsensusState) SetState

func (cs *ConsensusState) SetState(state State)

SetState method

func (*ConsensusState) ShuffleValidators

func (cs *ConsensusState) ShuffleValidators(cycle int64)

ShuffleValidators method

func (*ConsensusState) Start

func (cs *ConsensusState) Start()

Start It start first time starts the timeout receive routines.

func (*ConsensusState) Stop

func (cs *ConsensusState) Stop()

Stop timer and receive routine

func (*ConsensusState) String

func (cs *ConsensusState) String() string

---------------------------------------- String returns a string.

func (*ConsensusState) UpdateCBInfo

func (cs *ConsensusState) UpdateCBInfo(info *dty.DposCBInfo)

UpdateCBInfo method

func (*ConsensusState) UpdateTopNCandidators

func (cs *ConsensusState) UpdateTopNCandidators(info *dty.TopNCandidators)

UpdateTopNCandidators method

func (*ConsensusState) UpdateVrfInfo

func (cs *ConsensusState) UpdateVrfInfo(info *dty.VrfInfo)

UpdateVrfInfo method

func (*ConsensusState) UpdateVrfInfos

func (cs *ConsensusState) UpdateVrfInfos(cycle int64, infos []*dty.VrfInfo)

UpdateVrfInfos method

func (*ConsensusState) VerifyCBInfo

func (cs *ConsensusState) VerifyCBInfo(info *dty.DposCBInfo) bool

VerifyCBInfo method

func (*ConsensusState) VerifyNotify

func (cs *ConsensusState) VerifyNotify(notify *dpostype.DPosNotify) bool

VerifyNotify method

func (*ConsensusState) VerifyVote

func (cs *ConsensusState) VerifyVote(vote *dpostype.DPosVote) bool

VerifyVote method

func (*ConsensusState) VrfEvaluate

func (cs *ConsensusState) VrfEvaluate(input []byte) (hash [32]byte, proof []byte)

VrfEvaluate method

func (*ConsensusState) VrfProof

func (cs *ConsensusState) VrfProof(pubkey []byte, input []byte, hash [32]byte, proof []byte) bool

VrfProof method

type ID

type ID string

ID is a hex-encoded crypto.Address

type IP2IPPort

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

IP2IPPort struct

func NewMutexMap

func NewMutexMap() *IP2IPPort

NewMutexMap method

func (*IP2IPPort) Delete

func (ipp *IP2IPPort) Delete(ip string)

Delete method

func (*IP2IPPort) Has

func (ipp *IP2IPPort) Has(ip string) bool

Has method

func (*IP2IPPort) Set

func (ipp *IP2IPPort) Set(ip string, ipport string)

Set method

type InitState

type InitState struct {
}

InitState is the initial state of dpos state machine

type MsgInfo

type MsgInfo struct {
	TypeID byte
	Msg    proto.Message
	PeerID ID
	PeerIP string
}

MsgInfo struct

type Node

type Node struct {
	Network string
	Version string
	ID      ID
	IP      string //get ip from connect to ourself
	// contains filtered or unexported fields
}

Node struct

func NewNode

func NewNode(seeds []string, protocol string, lAddr string, privKey crypto.PrivKey, network string, version string, state *ConsensusState) *Node

NewNode method

func (*Node) Broadcast

func (node *Node) Broadcast(msg MsgInfo) chan bool

Broadcast to peers in set

func (*Node) BroadcastRoutine

func (node *Node) BroadcastRoutine()

BroadcastRoutine receive to broadcast

func (*Node) CompatibleWith

func (node *Node) CompatibleWith(other NodeInfo) error

CompatibleWith one node by nodeInfo

func (*Node) DialPeerWithAddress

func (node *Node) DialPeerWithAddress(addr string) error

DialPeerWithAddress ...

func (*Node) FilterConnByAddr

func (node *Node) FilterConnByAddr(addr net.Addr) error

FilterConnByAddr TODO:can make fileter by addr

func (*Node) IsRunning

func (node *Node) IsRunning() bool

IsRunning ...

func (*Node) Start

func (node *Node) Start(testFlag bool)

Start node

func (*Node) StartConsensusRoutine

func (node *Node) StartConsensusRoutine()

StartConsensusRoutine if peers reached the threshold start consensus routine

func (*Node) Stop

func (node *Node) Stop()

Stop ...

func (*Node) StopPeerForError

func (node *Node) StopPeerForError(peer Peer, reason interface{})

StopPeerForError called if error occurred

type NodeInfo

type NodeInfo struct {
	ID      ID     `json:"id"`
	Network string `json:"network"`
	Version string `json:"version"`
	IP      string `json:"ip,omitempty"`
}

NodeInfo struct

type Peer

type Peer interface {
	ID() ID
	RemoteIP() (net.IP, error) // remote IP of the connection
	RemoteAddr() (net.Addr, error)
	IsOutbound() bool
	IsPersistent() bool

	Send(msg MsgInfo) bool
	TrySend(msg MsgInfo) bool

	Stop()

	SetTransferChannel(chan MsgInfo)
}

Peer interface

type PeerSet

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

PeerSet struct

func NewPeerSet

func NewPeerSet() *PeerSet

NewPeerSet method

func (*PeerSet) Add

func (ps *PeerSet) Add(peer Peer) error

Add adds the peer to the PeerSet. It returns an error carrying the reason, if the peer is already present.

func (*PeerSet) Has

func (ps *PeerSet) Has(peerKey ID) bool

Has returns true if the set contains the peer referred to by this peerKey, otherwise false.

func (*PeerSet) HasIP

func (ps *PeerSet) HasIP(peerIP net.IP) bool

HasIP returns true if the set contains the peer referred to by this IP address, otherwise false.

func (*PeerSet) List

func (ps *PeerSet) List() []Peer

List returns the threadsafe list of peers.

func (*PeerSet) Remove

func (ps *PeerSet) Remove(peer Peer)

Remove discards peer by its Key, if the peer was previously memoized.

func (*PeerSet) Size

func (ps *PeerSet) Size() int

Size of list

type SecretConnection

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

SecretConnection Implements net.Conn

func MakeSecretConnection

func MakeSecretConnection(conn io.ReadWriteCloser, locPrivKey crypto.PrivKey) (*SecretConnection, error)

MakeSecretConnection Performs handshake and returns a new authenticated SecretConnection. Returns nil if error in handshake. Caller should call conn.Close() See docs/sts-final.pdf for more information.

func (*SecretConnection) Close

func (sc *SecretConnection) Close() error

Close Implements net.Conn

func (*SecretConnection) LocalAddr

func (sc *SecretConnection) LocalAddr() net.Addr

LocalAddr ...

func (*SecretConnection) Read

func (sc *SecretConnection) Read(data []byte) (n int, err error)

CONTRACT: data smaller than dataMaxSize is read atomically.

func (*SecretConnection) RemoteAddr

func (sc *SecretConnection) RemoteAddr() net.Addr

RemoteAddr ...

func (*SecretConnection) RemotePubKey

func (sc *SecretConnection) RemotePubKey() crypto.PubKey

RemotePubKey Returns authenticated remote pubkey

func (*SecretConnection) SetDeadline

func (sc *SecretConnection) SetDeadline(t time.Time) error

SetDeadline ...

func (*SecretConnection) SetReadDeadline

func (sc *SecretConnection) SetReadDeadline(t time.Time) error

SetReadDeadline ...

func (*SecretConnection) SetWriteDeadline

func (sc *SecretConnection) SetWriteDeadline(t time.Time) error

SetWriteDeadline ...

func (*SecretConnection) Write

func (sc *SecretConnection) Write(data []byte) (n int, err error)

Writes encrypted frames of `sealedFrameSize` CONTRACT: data smaller than dataMaxSize is read atomically.

type StackError

type StackError struct {
	Err   interface{}
	Stack []byte
}

StackError struct

func (StackError) Error

func (se StackError) Error() string

func (StackError) String

func (se StackError) String() string

type State

type State interface {
	// contains filtered or unexported methods
}

State is the base class of dpos state machine, it defines some interfaces.

type Task

type Task struct {
	NodeID      int64
	Cycle       int64
	CycleStart  int64
	CycleStop   int64
	PeriodStart int64
	PeriodStop  int64
	BlockStart  int64
	BlockStop   int64
}

Task 为计算当前时间所属周期的数据结构

func DecideTaskByTime

func DecideTaskByTime(now int64) (task Task)

DecideTaskByTime 根据时间戳计算所属的周期,包括cycle周期,负责出块周期,当前出块周期

type TopNVersionInfo

type TopNVersionInfo struct {
	Version           int64
	HeightStart       int64
	HeightStop        int64
	HeightToStart     int64
	HeightRegLimit    int64
	HeightUpdateLimit int64
}

TopNVersionInfo 为记录某一个区块高度对应的TopN更新的版本信息

func CalcTopNVersion

func CalcTopNVersion(height int64) (info TopNVersionInfo)

CalcTopNVersion 根据某一个区块高度计算对应的TopN更新的版本信息

type ValidatorMgr

type ValidatorMgr struct {
	// Immutable
	ChainID string

	// Validators are persisted to the database separately every time they change,
	// so we can query for historical validator sets.
	// Note that if s.LastBlockHeight causes a valset change,
	// we set s.LastHeightValidatorsChanged = s.LastBlockHeight + 1
	Validators            *ttypes.ValidatorSet
	VrfValidators         *ttypes.ValidatorSet
	NoVrfValidators       *ttypes.ValidatorSet
	LastCycleBoundaryInfo *dty.DposCBInfo
	ShuffleCycle          int64
	ShuffleType           int64 //0-no vrf 1-vrf 2-part vrf
	// The latest AppHash we've received from calling abci.Commit()
	AppHash []byte
}

ValidatorMgr ...

func MakeGenesisValidatorMgr

func MakeGenesisValidatorMgr(genDoc *ttypes.GenesisDoc) (ValidatorMgr, error)

MakeGenesisValidatorMgr creates validators from ttypes.GenesisDoc.

func (ValidatorMgr) Bytes

func (s ValidatorMgr) Bytes() []byte

Bytes serializes the State using go-wire.

func (ValidatorMgr) Copy

func (s ValidatorMgr) Copy() ValidatorMgr

Copy makes a copy of the State for mutating.

func (ValidatorMgr) Equals

func (s ValidatorMgr) Equals(s2 ValidatorMgr) bool

Equals returns true if the States are identical.

func (*ValidatorMgr) FillVoteItem

func (s *ValidatorMgr) FillVoteItem(voteItem *ttypes.VoteItem)

FillVoteItem method

func (*ValidatorMgr) GetIndexByPubKey

func (s *ValidatorMgr) GetIndexByPubKey(pubkey []byte) (index int)

GetIndexByPubKey method

func (*ValidatorMgr) GetValidatorByIndex

func (s *ValidatorMgr) GetValidatorByIndex(index int) (addr []byte, val *ttypes.Validator)

GetValidatorByIndex method

func (ValidatorMgr) GetValidators

func (s ValidatorMgr) GetValidators() (current *ttypes.ValidatorSet)

GetValidators returns the last and current validator sets.

func (ValidatorMgr) IsEmpty

func (s ValidatorMgr) IsEmpty() bool

IsEmpty returns true if the State is equal to the empty State.

func (*ValidatorMgr) UpdateFromVoteItem

func (s *ValidatorMgr) UpdateFromVoteItem(voteItem *ttypes.VoteItem) bool

UpdateFromVoteItem method

type VotedState

type VotedState struct {
}

VotedState is the voted state of dpos state machine after getting an agreement for a period

type VotingState

type VotingState struct {
}

VotingState is the voting state of dpos state machine until timeout or get an agreement by votes.

type WaitNofifyState

type WaitNofifyState struct {
}

WaitNofifyState is the state of dpos state machine to wait notify.

Directories

Path Synopsis
Package types is a generated protocol buffer package.
Package types is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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