miner

package
v0.0.0-...-4097cb8 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMinerIsRunning is returned when miner is running
	ErrMinerIsRunning = errors.New("miner is running")

	// ErrMinerIsStopped is returned when miner is stopped
	ErrMinerIsStopped = errors.New("miner is stopped")

	// ErrNodeIsSyncing is returned when the node is syncing
	ErrNodeIsSyncing = errors.New("can not start miner when syncing")
)

Functions

This section is empty.

Types

type Miner

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

Miner defines base elements of miner

func NewMiner

func NewMiner(addr common.Address, seele SeeleBackend, verifier types.DebtVerifier, engine consensus.Engine) *Miner

NewMiner constructs and returns a miner instance

func (*Miner) GetCoinbase

func (miner *Miner) GetCoinbase() common.Address

func (*Miner) GetEngine

func (miner *Miner) GetEngine() consensus.Engine

func (*Miner) IsMining

func (miner *Miner) IsMining() bool

IsMining returns true if the miner is started, otherwise false

func (*Miner) SetCoinbase

func (miner *Miner) SetCoinbase(coinbase common.Address)

SetCoinbase set the coinbase.

func (*Miner) SetThreads

func (miner *Miner) SetThreads(threads int)

SetThreads sets the number of mining threads.

func (*Miner) Start

func (miner *Miner) Start() error

Start is used to start the miner

func (*Miner) Stop

func (miner *Miner) Stop()

Stop is used to stop the miner

type Result

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

Result is the result mined by engine. It contains the raw task and mined block.

type SeeleBackend

type SeeleBackend interface {
	TxPool() *core.TransactionPool
	BlockChain() *core.Blockchain
	DebtPool() *core.DebtPool
	GenesisInfo() core.GenesisInfo
	GetAccountIndexDB() database.Database
	GetIndexAccountDB() database.Database
}

SeeleBackend wraps all methods required for minier.

type Task

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

Task is a mining work for engine, containing block header, transactions, and transaction receipts.

func NewTask

func NewTask(header *types.BlockHeader, coinbase common.Address, verifier types.DebtVerifier) *Task

NewTask return Task object

Jump to

Keyboard shortcuts

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