generator

package
v0.0.0-...-77dcbbd Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package generator implements block generation.

Index

Constants

View Source
const (
	KeyTypePlain     = "plain"
	KeyTypeEncrypted = "encrypted"
)

Variables

View Source
var (
	GeneratorDBPrefixGeneratedInfo = []byte{0}
	GeneratorDBPrefixKeys          = []byte{1}
)

Functions

This section is empty.

Types

type Consensus

type Consensus interface {
	Syncing() bool
	AddInternal(block *blockchain.Block)
	GetAggregateCommit() (*blockchain.AggregateCommit, error)
	Certify(from, to uint32, address codec.Lisk32, blsPrivateKey []byte) error
	Subscribe(topic string) <-chan interface{}
	GetSlotNumber(unixTime uint32) int
	GetSlotTime(slot int) uint32
	GetBFTHeights(context *diffdb.Database) (uint32, uint32, uint32, error)
	GetBFTParameters(context *diffdb.Database, height uint32) (*liskbft.BFTParams, error)
	GetGeneratorKeys(context *diffdb.Database, height uint32) (liskbft.Generators, error)
	HeaderHasPriority(context *diffdb.Database, header blockchain.SealedBlockHeader, height, maxHeightPrevoted, maxHeightPreviouslyForged uint32) (bool, error)
	ImpliesMaximalPrevotes(context *diffdb.Database, blockHeader blockchain.ReadableBlockHeader) (bool, error)
	BFTBeforeTransactionsExecute(blockHeader blockchain.SealedBlockHeader, diffStore *diffdb.Database) error
}

type FeePriorityTransactions

type FeePriorityTransactions []*TransactionWithFeePriority

func (FeePriorityTransactions) Len

func (h FeePriorityTransactions) Len() int

func (FeePriorityTransactions) Less

func (h FeePriorityTransactions) Less(i, j int) bool

func (*FeePriorityTransactions) Pop

func (h *FeePriorityTransactions) Pop() interface{}

func (*FeePriorityTransactions) Push

func (h *FeePriorityTransactions) Push(x interface{})

func (FeePriorityTransactions) Swap

func (h FeePriorityTransactions) Swap(i, j int)

type Generator

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

func NewGenerator

func NewGenerator(params *GeneratorParams) *Generator

func (*Generator) DisableGeneration

func (g *Generator) DisableGeneration(address codec.Lisk32)

func (*Generator) EnableGeneration

func (g *Generator) EnableGeneration(address codec.Lisk32, keys *PlainKeys)

func (*Generator) Init

func (g *Generator) Init(params *GeneratorInitParams) error

func (*Generator) IsGenerationEnabled

func (g *Generator) IsGenerationEnabled(address codec.Lisk32) bool

func (*Generator) Start

func (g *Generator) Start()

type GeneratorInfo

type GeneratorInfo struct {
	Height             uint32 `json:"height" fieldNumber:"1"`
	MaxHeightPrevoted  uint32 `json:"maxHeightPrevoted" fieldNumber:"2"`
	MaxHeightGenerated uint32 `json:"maxHeightGenerated" fieldNumber:"3"`
}

func (*GeneratorInfo) Decode

func (e *GeneratorInfo) Decode(data []byte) error

func (*GeneratorInfo) DecodeFromReader

func (e *GeneratorInfo) DecodeFromReader(reader *codec.Reader) error

func (*GeneratorInfo) DecodeStrict

func (e *GeneratorInfo) DecodeStrict(data []byte) error

func (*GeneratorInfo) DecodeStrictFromReader

func (e *GeneratorInfo) DecodeStrictFromReader(reader *codec.Reader) error

func (*GeneratorInfo) Encode

func (e *GeneratorInfo) Encode() []byte

func (GeneratorInfo) Equal

func (f GeneratorInfo) Equal(val *GeneratorInfo) bool

func (GeneratorInfo) IsZero

func (f GeneratorInfo) IsZero() bool

func (*GeneratorInfo) MustDecode

func (e *GeneratorInfo) MustDecode(data []byte)

type GeneratorInitParams

type GeneratorInitParams struct {
	CTX          context.Context
	Cfg          *config.Config
	Logger       log.Logger
	BlockchainDB *db.DB
	GeneratorDB  *db.DB
}

type GeneratorParams

type GeneratorParams struct {
	Consensus Consensus
	ABI       labi.ABI
	Pool      *txpool.TransactionPool
	Chain     *blockchain.Chain
}

type Keypair

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

func NewKeypair

func NewKeypair(
	address []byte,
	generationPublicKey []byte,
	generationPrivateKey []byte,
	blsPrivateKey []byte,
) *Keypair

func (*Keypair) Decode

func (e *Keypair) Decode(data []byte) error

func (*Keypair) DecodeFromReader

func (e *Keypair) DecodeFromReader(reader *codec.Reader) error

func (*Keypair) DecodeStrict

func (e *Keypair) DecodeStrict(data []byte) error

func (*Keypair) DecodeStrictFromReader

func (e *Keypair) DecodeStrictFromReader(reader *codec.Reader) error

func (*Keypair) Encode

func (e *Keypair) Encode() []byte

func (*Keypair) MustDecode

func (e *Keypair) MustDecode(data []byte)

type Keys

type Keys struct {
	Address codec.Lisk32 `json:"address" fieldNumber:"1"`
	Type    string       `json:"type" fieldNumber:"2"`
	Data    []byte       `json:"data" fieldNumber:"3"`
}

func (*Keys) Decode

func (e *Keys) Decode(data []byte) error

func (*Keys) DecodeFromReader

func (e *Keys) DecodeFromReader(reader *codec.Reader) error

func (*Keys) DecodeStrict

func (e *Keys) DecodeStrict(data []byte) error

func (*Keys) DecodeStrictFromReader

func (e *Keys) DecodeStrictFromReader(reader *codec.Reader) error

func (*Keys) Encode

func (e *Keys) Encode() []byte

func (*Keys) EncryptedKeys

func (k *Keys) EncryptedKeys() (*crypto.EncryptedMessage, error)

func (Keys) IsEncrypted

func (k Keys) IsEncrypted() bool

func (Keys) IsPlain

func (k Keys) IsPlain() bool

func (*Keys) MustDecode

func (e *Keys) MustDecode(data []byte)

func (*Keys) PlainKeys

func (k *Keys) PlainKeys() (*PlainKeys, error)

func (Keys) Validate

func (k Keys) Validate() error

type KeysFile

type KeysFile struct {
	Keys []*KeysFileItem `json:"keys"`
}

type KeysFileItem

type KeysFileItem struct {
	Address   codec.Lisk32             `json:"address"`
	Plain     *PlainKeys               `json:"plain"`
	Encrypted *crypto.EncryptedMessage `json:"encrypted"`
}

type PlainKeys

type PlainKeys struct {
	GeneratorKey        codec.Hex `json:"generatorKey" fieldNumber:"1"`
	GeneratorPrivateKey codec.Hex `json:"generatorPrivateKey" fieldNumber:"2"`
	BLSKey              codec.Hex `json:"blsKey" fieldNumber:"3"`
	BLSPrivateKey       codec.Hex `json:"blsPrivateKey" fieldNumber:"4"`
}

func (*PlainKeys) Decode

func (e *PlainKeys) Decode(data []byte) error

func (*PlainKeys) DecodeFromReader

func (e *PlainKeys) DecodeFromReader(reader *codec.Reader) error

func (*PlainKeys) DecodeStrict

func (e *PlainKeys) DecodeStrict(data []byte) error

func (*PlainKeys) DecodeStrictFromReader

func (e *PlainKeys) DecodeStrictFromReader(reader *codec.Reader) error

func (*PlainKeys) Encode

func (e *PlainKeys) Encode() []byte

func (*PlainKeys) MustDecode

func (e *PlainKeys) MustDecode(data []byte)

func (PlainKeys) Validate

func (k PlainKeys) Validate() error

type TransactionWithFeePriority

type TransactionWithFeePriority struct {
	*blockchain.Transaction
	FeePriority int
}

Jump to

Keyboard shortcuts

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