Documentation ¶
Index ¶
- Constants
- func DisableLog()
- func UseLogger(logger btclog.Logger)
- type Generator
- func (g *Generator) ContinueNextSlot() error
- func (g *Generator) GetTokenData() []byte
- func (g *Generator) MinerNewBlock()
- func (g *Generator) SetHandOverTime(handOverTime time.Time) error
- func (g *Generator) SetLocalMiner(localMiner MinerInterface)
- func (g *Generator) SetToken(token string)
- func (g *Generator) VerifyToken(pubKey []byte) bool
- type GeneratorHandOver
- type MinerInterface
- type MinerNewBlock
Constants ¶
View Source
const ( // If the generator id is NoGeneratorId, it means the generator is not saved in the peer NoGeneratorId = uint64(0xffffffffffffffff) MinerInterval = 40 * time.Second )
View Source
const ( HandOverTypeByEpochOrder = 0 HandOverTypeByVote = 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 Generator ¶
type Generator struct { GeneratorId uint64 // The validator id of generator Height int32 // The block height for the generator Timestamp int64 // The time of generator created Token string // The token for the generator, it signed by generate Validatorinfo *validatorinfo.ValidatorInfo MinerTime time.Time LocalMiner MinerInterface }
func NewGenerator ¶
func NewGenerator(validatorInfo *validatorinfo.ValidatorInfo, height int32, timestamp int64, token string) *Generator
func (*Generator) ContinueNextSlot ¶
func (*Generator) GetTokenData ¶
func (*Generator) MinerNewBlock ¶
func (g *Generator) MinerNewBlock()
func (*Generator) SetHandOverTime ¶
func (*Generator) SetLocalMiner ¶
func (g *Generator) SetLocalMiner(localMiner MinerInterface)
func (*Generator) VerifyToken ¶
type GeneratorHandOver ¶
type GeneratorHandOver struct { ValidatorId uint64 // The current validator id (current generator, or voter) HandOverType int32 // HandOverType: 0: HandOver by current generator with Epoch member Order, 1: Vote by Epoch member Timestamp int64 // The time of generator hand over Token string // The token for generator handover, it sign by current generator (HandOver), if the type is vote, it is signed by voter GeneratorId uint64 // The next validator id (next generator) Height int32 // The next block height }
func (*GeneratorHandOver) GetTokenData ¶
func (gho *GeneratorHandOver) GetTokenData() []byte
func (*GeneratorHandOver) VerifyToken ¶
func (gho *GeneratorHandOver) VerifyToken(pubKey []byte) bool
type MinerInterface ¶
type MinerNewBlock ¶
type MinerNewBlock struct { GeneratorId uint64 // The validator id of generator PublicKey [btcec.PubKeyBytesLenCompressed]byte // The public key of generator Height int32 // The block height for the generator MinerTime int64 // The time of generator created Hash *chainhash.Hash // Block hash Token string // The token for the generator, it signed by generate }
func (*MinerNewBlock) GetTokenData ¶
func (m *MinerNewBlock) GetTokenData() []byte
func (*MinerNewBlock) VerifyToken ¶
func (g *MinerNewBlock) VerifyToken(pubKey []byte) bool
Click to show internal directories.
Click to hide internal directories.