types

package
v1.67.2 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: BSD-3-Clause Imports: 26 Imported by: 0

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

View Source
const (
	VoteID      = byte(0x06)
	VoteReplyID = byte(0x07)
	NotifyID    = byte(0x08)
	CBInfoID    = byte(0x09)

	PacketTypePing = byte(0xff)
	PacketTypePong = byte(0xfe)
)

step and message id define

View Source
const (
	// RFC3339Millis ...
	RFC3339Millis = "2006-01-02T15:04:05.000Z" // forced microseconds

)

Variables

View Source
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

View Source
var (

	// Fmt ...
	Fmt = fmt.Sprintf
)
View Source
var (
	// MsgMap define
	MsgMap map[byte]reflect.Type
)

Functions

func CanonicalTime

func CanonicalTime(t time.Time) string

CanonicalTime ...

func Exit

func Exit(s string)

Exit ...

func Fingerprint

func Fingerprint(slice []byte) []byte

Fingerprint ...

func GenAddressByPubKey

func GenAddressByPubKey(pubkey crypto.PubKey) []byte

GenAddressByPubKey ...

func Init

func Init()

Init ...

func InitMessageMap

func InitMessageMap()

InitMessageMap ...

func PanicCrisis

func PanicCrisis(v interface{})

PanicCrisis ...

func PanicQ

func PanicQ(v interface{})

PanicQ ...

func PanicSanity

func PanicSanity(v interface{})

PanicSanity ...

func PubKeyFromString

func PubKeyFromString(pubkeystring string) (crypto.PubKey, error)

PubKeyFromString ...

func RandInt63n

func RandInt63n(n int64) int64

RandInt63n ...

func RandIntn

func RandIntn(n int) int

RandIntn ...

func RandUint32

func RandUint32() uint32

RandUint32 ...

func SignBytes

func SignBytes(chainID string, o Signable) []byte

SignBytes is a convenience method for getting the bytes to sign of a Signable.

func Tempfile

func Tempfile(prefix string) (*os.File, string)

Tempfile ...

func WriteFile

func WriteFile(filePath string, contents []byte, mode os.FileMode) error

WriteFile ...

func WriteFileAtomic

func WriteFileAtomic(filePath string, newBytes []byte, mode os.FileMode) error

WriteFileAtomic ...

Types

type CanonicalJSONNotify

type CanonicalJSONNotify struct {
	VoteItem *CanonicalJSONVoteItem `json:"vote,omitempty"`

	HeightStop      int64 `json:"heightStop,omitempty"`
	NotifyTimestamp int64 `json:"notifyTimestamp,omitempty"`
}

CanonicalJSONNotify ...

func CanonicalNotify

func CanonicalNotify(notify *Notify) CanonicalJSONNotify

CanonicalNotify ...

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 ...

func CanonicalVote

func CanonicalVote(vote *Vote) CanonicalJSONVote

CanonicalVote ...

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) Descriptor() ([]byte, []int)

func (*DPosVote) GetSignature

func (m *DPosVote) GetSignature() []byte

func (*DPosVote) GetVoteItem

func (m *DPosVote) GetVoteItem() *VoteItem

func (*DPosVote) GetVoteTimestamp

func (m *DPosVote) GetVoteTimestamp() int64

func (*DPosVote) GetVoterNodeAddress

func (m *DPosVote) GetVoterNodeAddress() []byte

func (*DPosVote) GetVoterNodeIndex

func (m *DPosVote) GetVoterNodeIndex() int32

func (*DPosVote) ProtoMessage

func (*DPosVote) ProtoMessage()

func (*DPosVote) Reset

func (m *DPosVote) Reset()

func (*DPosVote) String

func (m *DPosVote) String() string

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

type DefaultSigner struct {
	PrivKey crypto.PrivKey `json:"priv_key"`
}

DefaultSigner implements Signer. It uses a standard, unencrypted crypto.PrivKey.

func NewDefaultSigner

func NewDefaultSigner(priv crypto.PrivKey) *DefaultSigner

NewDefaultSigner returns an instance of DefaultSigner.

func (*DefaultSigner) Sign

func (ds *DefaultSigner) Sign(msg []byte) (crypto.Signature, error)

Sign implements Signer. It signs the byte slice with a private key.

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

type GenesisValidator struct {
	PubKey KeyText `json:"pub_key"`
	Name   string  `json:"name"`
}

GenesisValidator is an initial validator.

type KeyText

type KeyText struct {
	Kind string `json:"type"`
	Data string `json:"data"`
}

KeyText ...

type Notify

type Notify struct {
	*DPosNotify
}

Notify Represents a notify from validators for consensus.

func (*Notify) Copy

func (notify *Notify) Copy() *Notify

Copy ...

func (*Notify) Hash

func (notify *Notify) Hash() []byte

Hash ...

func (*Notify) String

func (notify *Notify) String() string

func (*Notify) Verify

func (notify *Notify) Verify(chainID string, pubKey crypto.PubKey) error

Verify ...

func (*Notify) WriteSignBytes

func (notify *Notify) WriteSignBytes(chainID string, w io.Writer, n *int, err *error)

WriteSignBytes ...

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.

func (*PrivValidatorImp) VrfProof

func (pv *PrivValidatorImp) VrfProof(pubkey []byte, input []byte, hash [32]byte, proof []byte) bool

VrfProof check the vrf.

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

type Signable interface {
	WriteSignBytes(chainID string, w io.Writer, n *int, err *error)
}

Signable is an interface for all signable things. It typically removes signatures before serializing.

type Signer

type Signer interface {
	Sign(msg []byte) (crypto.Signature, error)
}

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) Descriptor() ([]byte, []int)

func (*SuperNode) GetAddress

func (m *SuperNode) GetAddress() []byte

func (*SuperNode) GetPubKey

func (m *SuperNode) GetPubKey() []byte

func (*SuperNode) ProtoMessage

func (*SuperNode) ProtoMessage()

func (*SuperNode) Reset

func (m *SuperNode) Reset()

func (*SuperNode) String

func (m *SuperNode) String() string

type Validator

type Validator struct {
	Address []byte `json:"address"`
	PubKey  []byte `json:"pub_key"`
}

Validator ...

func NewValidator

func NewValidator(pubKey crypto.PubKey) *Validator

NewValidator ...

func (*Validator) Copy

func (v *Validator) Copy() *Validator

Copy Creates a new copy of the validator so we can mutate accum. Panics if the validator is nil.

func (*Validator) Hash

func (v *Validator) Hash() []byte

Hash computes the unique ID of a validator with a given voting power. It excludes the Accum value, which changes with every round.

func (*Validator) String

func (v *Validator) String() string

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 NewValidatorSet

func NewValidatorSet(vals []*Validator) *ValidatorSet

NewValidatorSet ...

func (*ValidatorSet) Add

func (valSet *ValidatorSet) Add(val *Validator) (added bool)

Add ...

func (*ValidatorSet) Copy

func (valSet *ValidatorSet) Copy() *ValidatorSet

Copy ...

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) Hash

func (valSet *ValidatorSet) Hash() []byte

Hash ...

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) Size

func (valSet *ValidatorSet) Size() int

Size ...

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.

func (*Vote) Copy

func (vote *Vote) Copy() *Vote

Copy ...

func (*Vote) Hash

func (vote *Vote) Hash() []byte

Hash ...

func (*Vote) String

func (vote *Vote) String() string

func (*Vote) Verify

func (vote *Vote) Verify(chainID string, pubKey crypto.PubKey) error

Verify ...

func (*Vote) WriteSignBytes

func (vote *Vote) WriteSignBytes(chainID string, w io.Writer, n *int, err *error)

WriteSignBytes ...

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) Descriptor() ([]byte, []int)

func (*VoteItem) GetCycle

func (m *VoteItem) GetCycle() int64

func (*VoteItem) GetCycleStart

func (m *VoteItem) GetCycleStart() int64

func (*VoteItem) GetCycleStop

func (m *VoteItem) GetCycleStop() int64

func (*VoteItem) GetHeight

func (m *VoteItem) GetHeight() int64

func (*VoteItem) GetLastCBInfo

func (m *VoteItem) GetLastCBInfo() *CycleBoundaryInfo

func (*VoteItem) GetNoVrfValidators

func (m *VoteItem) GetNoVrfValidators() []*SuperNode

func (*VoteItem) GetPeriodStart

func (m *VoteItem) GetPeriodStart() int64

func (*VoteItem) GetPeriodStop

func (m *VoteItem) GetPeriodStop() int64

func (*VoteItem) GetShuffleType

func (m *VoteItem) GetShuffleType() int64

func (*VoteItem) GetValidators

func (m *VoteItem) GetValidators() []*SuperNode

func (*VoteItem) GetVoteID

func (m *VoteItem) GetVoteID() []byte

func (*VoteItem) GetVotedNodeAddress

func (m *VoteItem) GetVotedNodeAddress() []byte

func (*VoteItem) GetVotedNodeIndex

func (m *VoteItem) GetVotedNodeIndex() int32

func (*VoteItem) GetVrfValidators

func (m *VoteItem) GetVrfValidators() []*SuperNode

func (*VoteItem) ProtoMessage

func (*VoteItem) ProtoMessage()

func (*VoteItem) Reset

func (m *VoteItem) Reset()

func (*VoteItem) String

func (m *VoteItem) String() string

Jump to

Keyboard shortcuts

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