miner

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2015 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Miner

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

func New

New returns a ready-to-go miner that is not mining.

func (*Miner) BlockForWork added in v0.3.2

func (m *Miner) BlockForWork() (types.Block, crypto.Hash, types.Target)

BlockForWork returns a block that is ready for nonce grinding, along with the root hash of the block.

func (*Miner) FindBlock added in v0.3.1

func (m *Miner) FindBlock() (types.Block, bool, error)

FindBlock will attempt to solve a block and add it to the state. While less efficient than StartMining, it is guaranteed to find at most one block.

func (*Miner) MinerInfo added in v0.3.1

func (m *Miner) MinerInfo() modules.MinerInfo

Info() returns a MinerInfo struct which can be converted to JSON to be parsed by frontends for displaying information to the user.

State is a string indicating what the miner is currently doing with respect to the number of threads it currently has vs. the number of threads it wants to have.

Threads is the number of threads that the miner currently wants to have.

RunningThreads is the number of threads that the miner currently has.

Address is the current address that is receiving block payouts.

func (*Miner) MinerNotify added in v0.3.1

func (m *Miner) MinerNotify() <-chan struct{}

MinerNotify adds a subscriber to the miner.

func (*Miner) ReceiveTransactionPoolUpdate added in v0.3.1

func (m *Miner) ReceiveTransactionPoolUpdate(revertedBlocks, appliedBlocks []types.Block, unconfirmedTransactions []types.Transaction, _ []modules.SiacoinOutputDiff)

ReceiveTransactionPoolUpdate listens to the transaction pool for changes in the transaction pool. These changes will be applied to the blocks being mined.

func (*Miner) SetThreads

func (m *Miner) SetThreads(threads int) error

SetThreads establishes how many threads the miner will use when mining.

func (*Miner) SolveBlock

func (m *Miner) SolveBlock(blockForWork types.Block, target types.Target) (b types.Block, solved bool)

SolveBlock attempts to solve a block, returning the solved block without submitting it to the state. This function is primarily to help with testing, and is very slow.

func (*Miner) StartMining

func (m *Miner) StartMining() error

StartMining spawns a bunch of mining threads which will mine until stop is called.

func (*Miner) StopMining

func (m *Miner) StopMining() error

StopMining sets desiredThreads to 0, a value which is polled by mining threads. When set to 0, the mining threads will all cease mining.

func (*Miner) SubmitBlock added in v0.3.2

func (m *Miner) SubmitBlock(b types.Block) error

SubmitBlock accepts a block with a valid target and presents it to the consensus set.

Jump to

Keyboard shortcuts

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