blocks

package
v0.2.11-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator added in v1.0.0

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

Generator generates a block from proposals.

func NewGenerator added in v1.0.0

func NewGenerator(atxDB atxProvider, meshDB meshProvider, opts ...GeneratorOpt) *Generator

NewGenerator creates new block generator.

func (*Generator) GenerateBlock

func (g *Generator) GenerateBlock(ctx context.Context, layerID types.LayerID, proposals []*types.Proposal) (*types.Block, error)

GenerateBlock generates a block from the list of Proposal.

type GeneratorOpt added in v1.0.0

type GeneratorOpt func(h *Generator)

GeneratorOpt for configuring BlockHandler.

func WithConfig added in v1.0.0

func WithConfig(cfg RewardConfig) GeneratorOpt

WithConfig defines cfg for Generator.

func WithGeneratorLogger added in v1.0.0

func WithGeneratorLogger(logger log.Log) GeneratorOpt

WithGeneratorLogger defines logger for Generator.

type Handler added in v1.0.0

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

Handler processes Block fetched from peers during sync.

func NewHandler added in v1.0.0

func NewHandler(f system.Fetcher, m meshProvider, opts ...Opt) *Handler

NewHandler creates new Handler.

func (*Handler) HandleBlockData

func (h *Handler) HandleBlockData(ctx context.Context, data []byte) error

HandleBlockData handles Block data from sync.

type Opt added in v1.0.0

type Opt func(*Handler)

Opt for configuring BlockHandler.

func WithLogger added in v1.0.0

func WithLogger(logger log.Log) Opt

WithLogger defines logger for Handler.

type RewardConfig

type RewardConfig struct {
	BaseReward uint64 `mapstructure:"base-reward"`
}

RewardConfig defines the configuration options for Spacemesh rewards.

func DefaultRewardConfig

func DefaultRewardConfig() RewardConfig

DefaultRewardConfig returns the default RewardConfig.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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