Documentation ¶
Overview ¶
Package types is a generated protocol buffer package.
It is generated from these files:
dpos_msg.proto
It has these top-level messages:
CycleBoundaryInfo SuperNode VoteItem DPosVote DPosVoteReply DPosNotify DPosCBInfo
Index ¶
- Constants
- Variables
- func CanonicalTime(t time.Time) string
- func Exit(s string)
- func Fingerprint(slice []byte) []byte
- func GenAddressByPubKey(pubkey crypto.PubKey) []byte
- func Init()
- func InitMessageMap()
- func PanicCrisis(v interface{})
- func PanicQ(v interface{})
- func PanicSanity(v interface{})
- func PubKeyFromString(pubkeystring string) (crypto.PubKey, error)
- func RandInt63n(n int64) int64
- func RandIntn(n int) int
- func RandUint32() uint32
- func SignBytes(chainID string, o Signable) []byte
- func Tempfile(prefix string) (*os.File, string)
- func WriteFile(filePath string, contents []byte, mode os.FileMode) error
- func WriteFileAtomic(filePath string, newBytes []byte, mode os.FileMode) error
- type CanonicalJSONNotify
- type CanonicalJSONOnceNotify
- type CanonicalJSONOnceVote
- type CanonicalJSONVote
- type CanonicalJSONVoteItem
- type CycleBoundaryInfo
- func (*CycleBoundaryInfo) Descriptor() ([]byte, []int)
- func (m *CycleBoundaryInfo) GetCycle() int64
- func (m *CycleBoundaryInfo) GetStopHash() string
- func (m *CycleBoundaryInfo) GetStopHeight() int64
- func (*CycleBoundaryInfo) ProtoMessage()
- func (m *CycleBoundaryInfo) Reset()
- func (m *CycleBoundaryInfo) String() string
- type DPosCBInfo
- func (*DPosCBInfo) Descriptor() ([]byte, []int)
- func (m *DPosCBInfo) GetCycle() int64
- func (m *DPosCBInfo) GetPubkey() string
- func (m *DPosCBInfo) GetSignature() string
- func (m *DPosCBInfo) GetStopHash() string
- func (m *DPosCBInfo) GetStopHeight() int64
- func (*DPosCBInfo) ProtoMessage()
- func (m *DPosCBInfo) Reset()
- func (m *DPosCBInfo) String() string
- type DPosNotify
- func (*DPosNotify) Descriptor() ([]byte, []int)
- func (m *DPosNotify) GetHashStop() []byte
- func (m *DPosNotify) GetHeightStop() int64
- func (m *DPosNotify) GetNotifyNodeAddress() []byte
- func (m *DPosNotify) GetNotifyNodeIndex() int32
- func (m *DPosNotify) GetNotifyTimestamp() int64
- func (m *DPosNotify) GetSignature() []byte
- func (m *DPosNotify) GetVote() *VoteItem
- func (*DPosNotify) ProtoMessage()
- func (m *DPosNotify) Reset()
- func (m *DPosNotify) String() string
- type DPosVote
- func (*DPosVote) Descriptor() ([]byte, []int)
- func (m *DPosVote) GetSignature() []byte
- func (m *DPosVote) GetVoteItem() *VoteItem
- func (m *DPosVote) GetVoteTimestamp() int64
- func (m *DPosVote) GetVoterNodeAddress() []byte
- func (m *DPosVote) GetVoterNodeIndex() int32
- func (*DPosVote) ProtoMessage()
- func (m *DPosVote) Reset()
- func (m *DPosVote) String() string
- type DPosVoteReply
- type DefaultSigner
- type GenesisDoc
- type GenesisValidator
- type KeyText
- type Notify
- type PrivValidator
- type PrivValidatorFS
- type PrivValidatorImp
- func (pv *PrivValidatorImp) GetAddress() []byte
- func (pv *PrivValidatorImp) GetPubKey() crypto.PubKey
- func (pv *PrivValidatorImp) Reset()
- func (pv *PrivValidatorImp) Save()
- func (pv *PrivValidatorImp) SignMsg(msg []byte) (sig crypto.Signature, err error)
- func (pv *PrivValidatorImp) SignNotify(chainID string, notify *Notify) error
- func (pv *PrivValidatorImp) SignTx(tx *types.Transaction)
- func (pv *PrivValidatorImp) SignVote(chainID string, vote *Vote) error
- func (pv *PrivValidatorImp) String() string
- func (pv *PrivValidatorImp) VrfEvaluate(input []byte) (hash [32]byte, proof []byte)
- func (pv *PrivValidatorImp) VrfProof(pubkey []byte, input []byte, hash [32]byte, proof []byte) bool
- type PrivValidatorsByAddress
- type Signable
- type Signer
- type SuperNode
- type Validator
- type ValidatorSet
- func (valSet *ValidatorSet) Add(val *Validator) (added bool)
- func (valSet *ValidatorSet) Copy() *ValidatorSet
- func (valSet *ValidatorSet) GetByAddress(address []byte) (index int, val *Validator)
- func (valSet *ValidatorSet) GetByIndex(index int) (address []byte, val *Validator)
- func (valSet *ValidatorSet) HasAddress(address []byte) bool
- func (valSet *ValidatorSet) Hash() []byte
- func (valSet *ValidatorSet) Iterate(fn func(index int, val *Validator) bool)
- func (valSet *ValidatorSet) Remove(address []byte) (val *Validator, removed bool)
- func (valSet *ValidatorSet) Size() int
- func (valSet *ValidatorSet) String() string
- func (valSet *ValidatorSet) StringIndented(indent string) string
- func (valSet *ValidatorSet) Update(val *Validator) (updated bool)
- type ValidatorsByAddress
- type Vote
- type VoteItem
- func (*VoteItem) Descriptor() ([]byte, []int)
- func (m *VoteItem) GetCycle() int64
- func (m *VoteItem) GetCycleStart() int64
- func (m *VoteItem) GetCycleStop() int64
- func (m *VoteItem) GetHeight() int64
- func (m *VoteItem) GetLastCBInfo() *CycleBoundaryInfo
- func (m *VoteItem) GetNoVrfValidators() []*SuperNode
- func (m *VoteItem) GetPeriodStart() int64
- func (m *VoteItem) GetPeriodStop() int64
- func (m *VoteItem) GetShuffleType() int64
- func (m *VoteItem) GetValidators() []*SuperNode
- func (m *VoteItem) GetVoteID() []byte
- func (m *VoteItem) GetVotedNodeAddress() []byte
- func (m *VoteItem) GetVotedNodeIndex() int32
- func (m *VoteItem) GetVrfValidators() []*SuperNode
- func (*VoteItem) ProtoMessage()
- func (m *VoteItem) Reset()
- func (m *VoteItem) String() string
Constants ¶
const ( VoteID = byte(0x06) VoteReplyID = byte(0x07) NotifyID = byte(0x08) CBInfoID = byte(0x09) PacketTypePing = byte(0xff) PacketTypePong = byte(0xfe) )
step and message id define
const ( // RFC3339Millis ... RFC3339Millis = "2006-01-02T15:04:05.000Z" // forced microseconds )
Variables ¶
var ( ErrNotifyInvalidValidatorAddress = errors.New("Invalid validator address for notify") ErrNotifyInvalidValidatorIndex = errors.New("Invalid validator index for notify") ErrNotifyInvalidSignature = errors.New("Invalid notify signature") ErrVoteInvalidValidatorIndex = errors.New("Invalid validator index for vote") ErrVoteInvalidValidatorAddress = errors.New("Invalid validator address for vote") ErrVoteInvalidSignature = errors.New("Invalid vote signature") ErrVoteNil = errors.New("Nil vote") ConsensusCrypto crypto.Crypto SecureConnCrypto crypto.Crypto )
error defines
var ( // Fmt ... Fmt = fmt.Sprintf )
var ( // MsgMap define MsgMap map[byte]reflect.Type )
Functions ¶
func GenAddressByPubKey ¶
GenAddressByPubKey ...
func PubKeyFromString ¶
PubKeyFromString ...
Types ¶
type CanonicalJSONNotify ¶
type CanonicalJSONNotify struct { VoteItem *CanonicalJSONVoteItem `json:"vote,omitempty"` HeightStop int64 `json:"heightStop,omitempty"` NotifyTimestamp int64 `json:"notifyTimestamp,omitempty"` }
CanonicalJSONNotify ...
type CanonicalJSONOnceNotify ¶
type CanonicalJSONOnceNotify struct { ChainID string `json:"chain_id"` Notify CanonicalJSONNotify `json:"vote"` }
CanonicalJSONOnceNotify ...
type CanonicalJSONOnceVote ¶
type CanonicalJSONOnceVote struct { ChainID string `json:"chain_id"` Vote CanonicalJSONVote `json:"vote"` }
CanonicalJSONOnceVote ...
type CanonicalJSONVote ¶
type CanonicalJSONVote struct { VoteItem *CanonicalJSONVoteItem `json:"vote,omitempty"` VoteTimestamp int64 `json:"voteTimestamp,omitempty"` VoterNodeIndex int32 `json:"voterNodeIndex,omitempty"` VoterNodeAddress []byte `json:"voterNodeAddress,omitempty"` }
CanonicalJSONVote ...
type CanonicalJSONVoteItem ¶
type CanonicalJSONVoteItem struct { VotedNodeIndex int32 `json:"votedNodeIndex,omitempty"` VotedNodeAddress []byte `json:"votedNodeAddress,omitempty"` CycleStart int64 `json:"cycleStart,omitempty"` CycleStop int64 `json:"cycleStop,omitempty"` PeriodStart int64 `json:"periodStart,omitempty"` PeriodStop int64 `json:"periodStop,omitempty"` Height int64 `json:"height,omitempty"` VoteID []byte `json:"voteID,omitempty"` }
CanonicalJSONVoteItem ...
type CycleBoundaryInfo ¶
type CycleBoundaryInfo struct { Cycle int64 `protobuf:"varint,1,opt,name=cycle" json:"cycle,omitempty"` StopHeight int64 `protobuf:"varint,2,opt,name=stopHeight" json:"stopHeight,omitempty"` StopHash string `protobuf:"bytes,3,opt,name=stopHash" json:"stopHash,omitempty"` }
CycleBoundaryInfo cycle边界信息
func (*CycleBoundaryInfo) Descriptor ¶
func (*CycleBoundaryInfo) Descriptor() ([]byte, []int)
func (*CycleBoundaryInfo) GetCycle ¶
func (m *CycleBoundaryInfo) GetCycle() int64
func (*CycleBoundaryInfo) GetStopHash ¶
func (m *CycleBoundaryInfo) GetStopHash() string
func (*CycleBoundaryInfo) GetStopHeight ¶
func (m *CycleBoundaryInfo) GetStopHeight() int64
func (*CycleBoundaryInfo) ProtoMessage ¶
func (*CycleBoundaryInfo) ProtoMessage()
func (*CycleBoundaryInfo) Reset ¶
func (m *CycleBoundaryInfo) Reset()
func (*CycleBoundaryInfo) String ¶
func (m *CycleBoundaryInfo) String() string
type DPosCBInfo ¶
type DPosCBInfo struct { Cycle int64 `protobuf:"varint,1,opt,name=cycle" json:"cycle,omitempty"` StopHeight int64 `protobuf:"varint,2,opt,name=stopHeight" json:"stopHeight,omitempty"` StopHash string `protobuf:"bytes,3,opt,name=stopHash" json:"stopHash,omitempty"` Pubkey string `protobuf:"bytes,4,opt,name=pubkey" json:"pubkey,omitempty"` Signature string `protobuf:"bytes,5,opt,name=signature" json:"signature,omitempty"` }
DPosCBInfo Cycle boundary注册信息。
func (*DPosCBInfo) Descriptor ¶
func (*DPosCBInfo) Descriptor() ([]byte, []int)
func (*DPosCBInfo) GetCycle ¶
func (m *DPosCBInfo) GetCycle() int64
func (*DPosCBInfo) GetPubkey ¶
func (m *DPosCBInfo) GetPubkey() string
func (*DPosCBInfo) GetSignature ¶
func (m *DPosCBInfo) GetSignature() string
func (*DPosCBInfo) GetStopHash ¶
func (m *DPosCBInfo) GetStopHash() string
func (*DPosCBInfo) GetStopHeight ¶
func (m *DPosCBInfo) GetStopHeight() int64
func (*DPosCBInfo) ProtoMessage ¶
func (*DPosCBInfo) ProtoMessage()
func (*DPosCBInfo) Reset ¶
func (m *DPosCBInfo) Reset()
func (*DPosCBInfo) String ¶
func (m *DPosCBInfo) String() string
type DPosNotify ¶
type DPosNotify struct { Vote *VoteItem `protobuf:"bytes,1,opt,name=vote" json:"vote,omitempty"` HeightStop int64 `protobuf:"varint,2,opt,name=heightStop" json:"heightStop,omitempty"` HashStop []byte `protobuf:"bytes,3,opt,name=hashStop,proto3" json:"hashStop,omitempty"` NotifyTimestamp int64 `protobuf:"varint,4,opt,name=notifyTimestamp" json:"notifyTimestamp,omitempty"` NotifyNodeIndex int32 `protobuf:"varint,5,opt,name=notifyNodeIndex" json:"notifyNodeIndex,omitempty"` NotifyNodeAddress []byte `protobuf:"bytes,6,opt,name=notifyNodeAddress,proto3" json:"notifyNodeAddress,omitempty"` Signature []byte `protobuf:"bytes,7,opt,name=signature,proto3" json:"signature,omitempty"` }
DPosNotify Dpos委托节点出块周期结束时,通知其他节点进行高度确认及新节点投票。
func (*DPosNotify) Descriptor ¶
func (*DPosNotify) Descriptor() ([]byte, []int)
func (*DPosNotify) GetHashStop ¶
func (m *DPosNotify) GetHashStop() []byte
func (*DPosNotify) GetHeightStop ¶
func (m *DPosNotify) GetHeightStop() int64
func (*DPosNotify) GetNotifyNodeAddress ¶
func (m *DPosNotify) GetNotifyNodeAddress() []byte
func (*DPosNotify) GetNotifyNodeIndex ¶
func (m *DPosNotify) GetNotifyNodeIndex() int32
func (*DPosNotify) GetNotifyTimestamp ¶
func (m *DPosNotify) GetNotifyTimestamp() int64
func (*DPosNotify) GetSignature ¶
func (m *DPosNotify) GetSignature() []byte
func (*DPosNotify) GetVote ¶
func (m *DPosNotify) GetVote() *VoteItem
func (*DPosNotify) ProtoMessage ¶
func (*DPosNotify) ProtoMessage()
func (*DPosNotify) Reset ¶
func (m *DPosNotify) Reset()
func (*DPosNotify) String ¶
func (m *DPosNotify) String() string
type DPosVote ¶
type DPosVote struct { VoteItem *VoteItem `protobuf:"bytes,1,opt,name=voteItem" json:"voteItem,omitempty"` VoteTimestamp int64 `protobuf:"varint,2,opt,name=voteTimestamp" json:"voteTimestamp,omitempty"` VoterNodeIndex int32 `protobuf:"varint,3,opt,name=voterNodeIndex" json:"voterNodeIndex,omitempty"` VoterNodeAddress []byte `protobuf:"bytes,4,opt,name=voterNodeAddress,proto3" json:"voterNodeAddress,omitempty"` Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"` }
DPosVote Dpos共识的节点投票,为达成共识用。
func (*DPosVote) Descriptor ¶
func (*DPosVote) GetSignature ¶
func (*DPosVote) GetVoteItem ¶
func (*DPosVote) GetVoteTimestamp ¶
func (*DPosVote) GetVoterNodeAddress ¶
func (*DPosVote) GetVoterNodeIndex ¶
func (*DPosVote) ProtoMessage ¶
func (*DPosVote) ProtoMessage()
type DPosVoteReply ¶
type DPosVoteReply struct {
Vote *DPosVote `protobuf:"bytes,1,opt,name=vote" json:"vote,omitempty"`
}
DPosVoteReply 投票响应。
func (*DPosVoteReply) Descriptor ¶
func (*DPosVoteReply) Descriptor() ([]byte, []int)
func (*DPosVoteReply) GetVote ¶
func (m *DPosVoteReply) GetVote() *DPosVote
func (*DPosVoteReply) ProtoMessage ¶
func (*DPosVoteReply) ProtoMessage()
func (*DPosVoteReply) Reset ¶
func (m *DPosVoteReply) Reset()
func (*DPosVoteReply) String ¶
func (m *DPosVoteReply) String() string
type DefaultSigner ¶
DefaultSigner implements Signer. It uses a standard, unencrypted crypto.PrivKey.
func NewDefaultSigner ¶
func NewDefaultSigner(priv crypto.PrivKey) *DefaultSigner
NewDefaultSigner returns an instance of DefaultSigner.
type GenesisDoc ¶
type GenesisDoc struct { GenesisTime time.Time `json:"genesis_time"` ChainID string `json:"chain_id"` Validators []GenesisValidator `json:"validators"` AppHash []byte `json:"app_hash"` AppOptions interface{} `json:"app_options,omitempty"` }
GenesisDoc defines the initial conditions for a tendermint blockchain, in particular its validator set.
func GenesisDocFromFile ¶
func GenesisDocFromFile(genDocFile string) (*GenesisDoc, error)
GenesisDocFromFile reads JSON data from a file and unmarshalls it into a GenesisDoc.
func GenesisDocFromJSON ¶
func GenesisDocFromJSON(jsonBlob []byte) (*GenesisDoc, error)
GenesisDocFromJSON unmarshalls JSON data into a GenesisDoc.
func (*GenesisDoc) SaveAs ¶
func (genDoc *GenesisDoc) SaveAs(file string) error
SaveAs is a utility method for saving GenensisDoc as a JSON file.
func (*GenesisDoc) ValidateAndComplete ¶
func (genDoc *GenesisDoc) ValidateAndComplete() error
ValidateAndComplete checks that all necessary fields are present and fills in defaults for optional fields left empty
func (*GenesisDoc) ValidatorHash ¶
func (genDoc *GenesisDoc) ValidatorHash() []byte
ValidatorHash returns the hash of the validator set contained in the GenesisDoc
type GenesisValidator ¶
GenesisValidator is an initial validator.
type Notify ¶
type Notify struct {
*DPosNotify
}
Notify Represents a notify from validators for consensus.
type PrivValidator ¶
type PrivValidator interface { GetAddress() []byte // redundant since .PubKey().Address() GetPubKey() crypto.PubKey SignVote(chainID string, vote *Vote) error SignNotify(chainID string, notify *Notify) error SignMsg(msg []byte) (sig crypto.Signature, err error) SignTx(tx *types.Transaction) VrfEvaluate(input []byte) (hash [32]byte, proof []byte) VrfProof(pubkey []byte, input []byte, hash [32]byte, proof []byte) bool }
PrivValidator defines the functionality of a local Tendermint validator that signs votes, proposals, and heartbeats, and never double signs.
type PrivValidatorFS ¶
type PrivValidatorFS struct { Address string `json:"address"` PubKey KeyText `json:"pub_key"` // PrivKey should be empty if a Signer other than the default is being used. PrivKey KeyText `json:"priv_key"` }
PrivValidatorFS implements PrivValidator using data persisted to disk to prevent double signing. The Signer itself can be mutated to use something besides the default, for instance a hardware signer.
type PrivValidatorImp ¶
type PrivValidatorImp struct { Address []byte PubKey crypto.PubKey // PrivKey should be empty if a Signer other than the default is being used. PrivKey crypto.PrivKey Signer `json:"-"` // contains filtered or unexported fields }
PrivValidatorImp ...
func GenPrivValidatorImp ¶
func GenPrivValidatorImp(filePath string) *PrivValidatorImp
GenPrivValidatorImp generates a new validator with randomly generated private key and sets the filePath, but does not call Save().
func LoadOrGenPrivValidatorFS ¶
func LoadOrGenPrivValidatorFS(filePath string) *PrivValidatorImp
LoadOrGenPrivValidatorFS loads a PrivValidatorFS from the given filePath or else generates a new one and saves it to the filePath.
func LoadPrivValidatorFS ¶
func LoadPrivValidatorFS(filePath string) *PrivValidatorImp
LoadPrivValidatorFS loads a PrivValidatorImp from the filePath.
func LoadPrivValidatorFSWithSigner ¶
func LoadPrivValidatorFSWithSigner(filePath string, signerFunc func(PrivValidator) Signer) *PrivValidatorImp
LoadPrivValidatorFSWithSigner loads a PrivValidatorFS with a custom signer object. The PrivValidatorFS handles double signing prevention by persisting data to the filePath, while the Signer handles the signing. If the filePath does not exist, the PrivValidatorFS must be created manually and saved.
func (*PrivValidatorImp) GetAddress ¶
func (pv *PrivValidatorImp) GetAddress() []byte
GetAddress returns the address of the validator. Implements PrivValidator.
func (*PrivValidatorImp) GetPubKey ¶
func (pv *PrivValidatorImp) GetPubKey() crypto.PubKey
GetPubKey returns the public key of the validator. Implements PrivValidator.
func (*PrivValidatorImp) Reset ¶
func (pv *PrivValidatorImp) Reset()
Reset resets all fields in the PrivValidatorFS. NOTE: Unsafe!
func (*PrivValidatorImp) Save ¶
func (pv *PrivValidatorImp) Save()
Save persists the PrivValidatorFS to disk.
func (*PrivValidatorImp) SignMsg ¶
func (pv *PrivValidatorImp) SignMsg(msg []byte) (sig crypto.Signature, err error)
SignMsg signs a msg.
func (*PrivValidatorImp) SignNotify ¶
func (pv *PrivValidatorImp) SignNotify(chainID string, notify *Notify) error
SignNotify signs a canonical representation of the notify, along with the chainID. Implements PrivValidator.
func (*PrivValidatorImp) SignTx ¶
func (pv *PrivValidatorImp) SignTx(tx *types.Transaction)
SignTx signs a tx, Implements PrivValidator.
func (*PrivValidatorImp) SignVote ¶
func (pv *PrivValidatorImp) SignVote(chainID string, vote *Vote) error
SignVote signs a canonical representation of the vote, along with the chainID. Implements PrivValidator.
func (*PrivValidatorImp) String ¶
func (pv *PrivValidatorImp) String() string
String returns a string representation of the PrivValidatorImp.
func (*PrivValidatorImp) VrfEvaluate ¶
func (pv *PrivValidatorImp) VrfEvaluate(input []byte) (hash [32]byte, proof []byte)
VrfEvaluate use input to generate hash & proof.
type PrivValidatorsByAddress ¶
type PrivValidatorsByAddress []*PrivValidatorImp
PrivValidatorsByAddress ...
func (PrivValidatorsByAddress) Len ¶
func (pvs PrivValidatorsByAddress) Len() int
func (PrivValidatorsByAddress) Less ¶
func (pvs PrivValidatorsByAddress) Less(i, j int) bool
func (PrivValidatorsByAddress) Swap ¶
func (pvs PrivValidatorsByAddress) Swap(i, j int)
type Signable ¶
Signable is an interface for all signable things. It typically removes signatures before serializing.
type Signer ¶
Signer is an interface that defines how to sign messages. It is the caller's duty to verify the msg before calling Sign, eg. to avoid double signing. Currently, the only callers are SignVote, SignProposal, and SignHeartbeat.
type SuperNode ¶
type SuperNode struct { Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` PubKey []byte `protobuf:"bytes,2,opt,name=pubKey,proto3" json:"pubKey,omitempty"` }
SuperNode 超级节点信息
func (*SuperNode) Descriptor ¶
func (*SuperNode) GetAddress ¶
func (*SuperNode) ProtoMessage ¶
func (*SuperNode) ProtoMessage()
type Validator ¶
Validator ...
func (*Validator) Copy ¶
Copy Creates a new copy of the validator so we can mutate accum. Panics if the validator is nil.
type ValidatorSet ¶
type ValidatorSet struct { // NOTE: persisted via reflect, must be exported. Validators []*Validator `json:"validators"` }
ValidatorSet represent a set of *Validator at a given height. The validators can be fetched by address or index. The index is in order of .Address, so the indices are fixed for all rounds of a given blockchain height. On the other hand, the .AccumPower of each validator and the designated .GetProposer() of a set changes every round, upon calling .IncrementAccum(). NOTE: Not goroutine-safe. NOTE: All get/set to validators should copy the value for safety. TODO: consider validator Accum overflow
func (*ValidatorSet) GetByAddress ¶
func (valSet *ValidatorSet) GetByAddress(address []byte) (index int, val *Validator)
GetByAddress ...
func (*ValidatorSet) GetByIndex ¶
func (valSet *ValidatorSet) GetByIndex(index int) (address []byte, val *Validator)
GetByIndex returns the validator by index. It returns nil values if index < 0 or index >= len(ValidatorSet.Validators)
func (*ValidatorSet) HasAddress ¶
func (valSet *ValidatorSet) HasAddress(address []byte) bool
HasAddress ...
func (*ValidatorSet) Iterate ¶
func (valSet *ValidatorSet) Iterate(fn func(index int, val *Validator) bool)
Iterate ...
func (*ValidatorSet) Remove ¶
func (valSet *ValidatorSet) Remove(address []byte) (val *Validator, removed bool)
Remove ...
func (*ValidatorSet) String ¶
func (valSet *ValidatorSet) String() string
func (*ValidatorSet) StringIndented ¶
func (valSet *ValidatorSet) StringIndented(indent string) string
StringIndented ...
func (*ValidatorSet) Update ¶
func (valSet *ValidatorSet) Update(val *Validator) (updated bool)
Update ...
type ValidatorsByAddress ¶
type ValidatorsByAddress []*Validator
ValidatorsByAddress ...
func (ValidatorsByAddress) Len ¶
func (vs ValidatorsByAddress) Len() int
func (ValidatorsByAddress) Less ¶
func (vs ValidatorsByAddress) Less(i, j int) bool
func (ValidatorsByAddress) Swap ¶
func (vs ValidatorsByAddress) Swap(i, j int)
type Vote ¶
type Vote struct {
*DPosVote
}
Vote Represents a vote from validators for consensus.
type VoteItem ¶
type VoteItem struct { VotedNodeIndex int32 `protobuf:"varint,1,opt,name=votedNodeIndex" json:"votedNodeIndex,omitempty"` VotedNodeAddress []byte `protobuf:"bytes,2,opt,name=votedNodeAddress,proto3" json:"votedNodeAddress,omitempty"` Cycle int64 `protobuf:"varint,3,opt,name=cycle" json:"cycle,omitempty"` CycleStart int64 `protobuf:"varint,4,opt,name=cycleStart" json:"cycleStart,omitempty"` CycleStop int64 `protobuf:"varint,5,opt,name=cycleStop" json:"cycleStop,omitempty"` PeriodStart int64 `protobuf:"varint,6,opt,name=periodStart" json:"periodStart,omitempty"` PeriodStop int64 `protobuf:"varint,7,opt,name=periodStop" json:"periodStop,omitempty"` Height int64 `protobuf:"varint,8,opt,name=height" json:"height,omitempty"` VoteID []byte `protobuf:"bytes,9,opt,name=voteID,proto3" json:"voteID,omitempty"` LastCBInfo *CycleBoundaryInfo `protobuf:"bytes,10,opt,name=lastCBInfo" json:"lastCBInfo,omitempty"` ShuffleType int64 `protobuf:"varint,11,opt,name=shuffleType" json:"shuffleType,omitempty"` Validators []*SuperNode `protobuf:"bytes,12,rep,name=validators" json:"validators,omitempty"` VrfValidators []*SuperNode `protobuf:"bytes,13,rep,name=vrfValidators" json:"vrfValidators,omitempty"` NoVrfValidators []*SuperNode `protobuf:"bytes,14,rep,name=noVrfValidators" json:"noVrfValidators,omitempty"` }
VoteItem 投票信息
func (*VoteItem) Descriptor ¶
func (*VoteItem) GetCycleStart ¶
func (*VoteItem) GetCycleStop ¶
func (*VoteItem) GetLastCBInfo ¶
func (m *VoteItem) GetLastCBInfo() *CycleBoundaryInfo
func (*VoteItem) GetNoVrfValidators ¶
func (*VoteItem) GetPeriodStart ¶
func (*VoteItem) GetPeriodStop ¶
func (*VoteItem) GetShuffleType ¶
func (*VoteItem) GetValidators ¶
func (*VoteItem) GetVotedNodeAddress ¶
func (*VoteItem) GetVotedNodeIndex ¶
func (*VoteItem) GetVrfValidators ¶
func (*VoteItem) ProtoMessage ¶
func (*VoteItem) ProtoMessage()