miner

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: LGPL-3.0 Imports: 16 Imported by: 2

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

func PrintableOutputTask added in v1.3.0

func PrintableOutputTask(task *Task) map[string]interface{}

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) GetCurrentWorkHeader added in v1.3.0

func (miner *Miner) GetCurrentWorkHeader() (header *types.BlockHeader)

func (*Miner) GetEngine

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

func (*Miner) GetTaskDifficulty added in v1.3.0

func (miner *Miner) GetTaskDifficulty() *big.Int

func (*Miner) GetWork added in v1.3.0

func (miner *Miner) GetWork() map[string]interface{}

GetWork get the current task node will process

func (*Miner) GetWorkTask added in v1.3.0

func (miner *Miner) GetWorkTask() *Task

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
}

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