miner

package
v1.8.14-0...-45eaef2 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package miner implements Ethereum block creation and mining.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent added in v0.8.4

type Agent interface {
	AssignTask(*Package)
	DeliverTo(chan<- *Package)
	Start()
	Stop()
}

Agent can register themselves with the worker

type Backend added in v1.5.0

type Backend interface {
	AccountManager() *accounts.Manager
	BlockChain() *core.BlockChain
	TxPool() *core.TxPool
	ChainDb() ethdb.Database
}

Backend wraps all methods required for mining.

type CpuAgent added in v0.9.20

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

func NewCpuAgent added in v0.9.20

func NewCpuAgent(chain consensus.ChainReader, engine consensus.Engine) *CpuAgent

func (*CpuAgent) AssignTask

func (self *CpuAgent) AssignTask(p *Package)

func (*CpuAgent) DeliverTo

func (self *CpuAgent) DeliverTo(ch chan<- *Package)

func (*CpuAgent) Start added in v0.9.20

func (self *CpuAgent) Start()

func (*CpuAgent) Stop added in v0.9.20

func (self *CpuAgent) Stop()

type Env

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

Env is the workers current environment and holds all of the current state information.

type Miner

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

Miner creates blocks and searches for proof-of-work values.

func New

func New(eth Backend, config *params.ChainConfig, mux *event.TypeMux, engine consensus.Engine) *Miner

func (*Miner) HashRate added in v0.8.4

func (self *Miner) HashRate() uint64

func (*Miner) Mining

func (self *Miner) Mining() bool

func (*Miner) Pending added in v1.4.0

func (self *Miner) Pending() (*types.Block, *state.StateDB)

Pending returns the currently pending block and associated state.

func (*Miner) PendingBlock added in v0.9.17

func (self *Miner) PendingBlock() *types.Block

PendingBlock returns the currently pending block.

Note, to access both the pending block and the pending state simultaneously, please use Pending(), as the pending state can change between multiple method calls

func (*Miner) Register added in v0.9.17

func (self *Miner) Register(agent Agent)

func (*Miner) SetEtherbase added in v0.9.36

func (self *Miner) SetEtherbase(addr common.Address)

func (*Miner) SetExtra added in v0.9.17

func (self *Miner) SetExtra(extra []byte) error

func (*Miner) Start

func (self *Miner) Start(coinbase common.Address)

func (*Miner) Stop

func (self *Miner) Stop()

func (*Miner) Unregister added in v1.3.1

func (self *Miner) Unregister(agent Agent)

type Package

type Package struct {
	Receipts []*types.Receipt
	State    *state.StateDB
	Block    *types.Block
}

Package contains all information for consensus engine sealing and result submitting.

Jump to

Keyboard shortcuts

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