miner

package
v0.2.1-beta.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package miner is responsible for creating valid blocks that contain valid activation transactions and transactions

Index

Constants

View Source
const AtxsPerBlockLimit = 100

AtxsPerBlockLimit indicates the maximum number of atxs a block can reference

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockBuilder

type BlockBuilder struct {
	log.Log

	TransactionPool txPool
	// contains filtered or unexported fields
}

BlockBuilder is the struct that orchestrates the building of blocks, it is responsible for receiving hare results. referencing txs and atxs from mem pool and referencing them in the created block it is also responsible for listening to the clock and querying when a block should be created according to the block oracle

func NewBlockBuilder

func NewBlockBuilder(
	config Config,
	sgn signer,
	net p2p.Service,
	beginRoundEvent chan types.LayerID,
	orph meshProvider,
	bbp baseBlockProvider,
	blockOracle blockOracle,
	syncer syncer,
	projector projector,
	txPool txPool,
	logger log.Log,
) *BlockBuilder

NewBlockBuilder creates a struct of block builder type.

func (*BlockBuilder) Close

func (t *BlockBuilder) Close() error

Close stops listeners and stops trying to create block in layers

func (*BlockBuilder) Start

func (t *BlockBuilder) Start(ctx context.Context) error

Start starts the process of creating a block, it listens for txs and atxs received by gossip, and starts querying block oracle when it should create a block. This function returns an error if Start was already called once

type Config added in v0.1.15

type Config struct {
	MinerID        types.NodeID
	Hdist          uint32
	AtxsPerBlock   int
	LayersPerEpoch uint32
	TxsPerBlock    int
}

Config is the block builders configuration struct

Jump to

Keyboard shortcuts

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