mining

package
v0.0.0-...-7abacdd Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: Unlicense Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CPUMiner

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

CPUMiner mines blocks using the CPU.

func (*CPUMiner) Mine

func (c *CPUMiner) Mine(prevBlock *block.Block) (block.Block, error)

Mine solves a block's puzzle and returns the mined block if it suceeds.

If lastBlock is nil, it will mine the genesis block.

It must be called inside a goroutine.

type Miner

type Miner interface {
	Mine(lastBlock *block.Block) (block.Block, error)
}

Miner provides facilities for solving blocks.

func NewCPUMiner

func NewCPUMiner(accountName string, txPool *mempool.TxPool, newBlocks <-chan block.Block) (Miner, error)

NewCPUMiner returns an object that mines blocks with the CPU.

Jump to

Keyboard shortcuts

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