Documentation ¶
Index ¶
- Constants
- func DisableLog()
- func UseLogger(logger btclog.Logger)
- type DelEpochMember
- type Epoch
- func (e *Epoch) AddValidatorToEpoch(validatorInfo *validatorinfo.ValidatorInfo) error
- func (e *Epoch) DelEpochMember(validatorId uint64) error
- func (e *Epoch) GetCreateTime() time.Time
- func (e *Epoch) GetCurGeneratorPos() int32
- func (e *Epoch) GetGenerator() *generator.Generator
- func (e *Epoch) GetMemberCount() int32
- func (e *Epoch) GetMemberValidatorId(pos int32) uint64
- func (e *Epoch) GetNextValidator() *EpochItem
- func (e *Epoch) GetNextValidatorByEpochOrder() *EpochItem
- func (e *Epoch) GetValidatorList() []*EpochItem
- func (e *Epoch) GetValidatorPos(validatorId uint64) int32
- func (e *Epoch) IsExist(validatorId uint64) bool
- func (e *Epoch) IsLastGenerator() bool
- func (e *Epoch) IsValidEpochValidator(validatorInfo *validatorinfo.ValidatorInfo) bool
- func (e *Epoch) ToNextGenerator(generator *generator.Generator) error
- func (e *Epoch) UpdateGenerator(generator *generator.Generator)
- func (e *Epoch) VoteGenerator() *EpochItem
- type EpochItem
- type HandOverEpoch
- type NewEpochVote
Constants ¶
View Source
const ( // The reason code for delete epoch member DelCode_Disconnect = 1 DelCode_NoBlockProduced = 2 )
View Source
const ( DelEpochMemberResult_NotConfirm = uint32(0) DelEpochMemberResult_Agree = uint32(1) DelEpochMemberResult_Reject = uint32(2) )
View Source
const (
Pos_Epoch_NotStarted = -1
)
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.
Types ¶
type DelEpochMember ¶
type DelEpochMember struct { // validator id ValidatorId uint64 // The validator id for confirm epoch member delete DelValidatorId uint64 // The validator id to be deleted DelCode uint32 // The reason code for delete epoch member EpochIndex int64 // The epoch index for confirm epoch member delete Result uint32 // The result for confirm, DelEpochMemberResult_NotConfirm, DelEpochMemberResult_Agree, DelEpochMemberResult_Reject Token string // The token for epoch handover, it sign by validator to be confirmed }
Confirm to delete an epoch member from the current epoch list
func (*DelEpochMember) GetDelEpochMemTokenData ¶
func (he *DelEpochMember) GetDelEpochMemTokenData() []byte
func (*DelEpochMember) VerifyToken ¶
func (he *DelEpochMember) VerifyToken(pubKey []byte) bool
type Epoch ¶
type Epoch struct { EpochIndex int64 // Epoch Index, start from 0 CreateHeight int32 // 创建Epoch时当前Block的高度 CreateTime time.Time // 当前Epoch的创建时间 ItemList []*EpochItem // 当前Epoch包含的验证者列表,(已排序), 在一个Epoch结束前不会改变 Generator *generator.Generator // 当前Generator CurGeneratorPos int32 // 当前Generator在ItemList中的位置 // CurrentHeight uint64 // 当前Block chain的高度 LastChangeTime time.Time // 最后一次改变的时间, 用于判断是否需要更新, Epoch的改变包括创建, 转正,generator流转,成员删除 VCBlockHeight int64 // 记录当前epoch改变的的VCblock高度 VCBlockHash *chainhash.Hash // 记录当前epoch改变的的VCblock hash }
func (*Epoch) AddValidatorToEpoch ¶
func (e *Epoch) AddValidatorToEpoch(validatorInfo *validatorinfo.ValidatorInfo) error
func (*Epoch) DelEpochMember ¶
func (*Epoch) GetCreateTime ¶
func (*Epoch) GetCurGeneratorPos ¶
func (*Epoch) GetGenerator ¶
func (*Epoch) GetMemberCount ¶
func (*Epoch) GetMemberValidatorId ¶
func (*Epoch) GetNextValidator ¶
func (*Epoch) GetNextValidatorByEpochOrder ¶
func (*Epoch) GetValidatorList ¶
func (*Epoch) GetValidatorPos ¶
func (*Epoch) IsLastGenerator ¶
func (*Epoch) IsValidEpochValidator ¶
func (e *Epoch) IsValidEpochValidator(validatorInfo *validatorinfo.ValidatorInfo) bool
func (*Epoch) ToNextGenerator ¶
func (*Epoch) UpdateGenerator ¶
func (*Epoch) VoteGenerator ¶
type HandOverEpoch ¶
type HandOverEpoch struct { // Request validator id ValidatorId uint64 Timestamp int64 // The time of generator hand over, it should be time of completed miner last block Token string // The token for epoch handover, it sign by current generator (HandOver), if the type is New Epoch, it is signed by Epoch Requester (Epoch member) NextEpochIndex int64 // Next epoch index NextHeight int32 // The next block height }
func (*HandOverEpoch) GetNextEpochTokenData ¶
func (he *HandOverEpoch) GetNextEpochTokenData() []byte
func (*HandOverEpoch) VerifyToken ¶
func (he *HandOverEpoch) VerifyToken(pubKey []byte) bool
type NewEpochVote ¶
type NewEpochVote struct { NewEpoch *Epoch Reason uint32 VotorId uint64 PublicKey [btcec.PubKeyBytesLenCompressed]byte Token string Hash *chainhash.Hash // epoch block hash }
func (*NewEpochVote) GetTokenData ¶
func (nev *NewEpochVote) GetTokenData() []byte
func (*NewEpochVote) VerifyToken ¶
func (nev *NewEpochVote) VerifyToken(pubKey []byte) bool
Click to show internal directories.
Click to hide internal directories.