zpow

package
v0.0.0-...-f58d8a1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: LGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func (*API) GetDetrate

func (api *API) GetDetrate() uint64

GetDetrate returns the current detrate for local CPU miner and remote miner.

func (*API) GetThreads

func (api *API) GetThreads() int

GetThreads returns the thread number of the miner engine

type ZpowEngine

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

Engine provides the consensus operations based on ZPOW.

func NewZpowEngine

func NewZpowEngine(threads int) *ZpowEngine

func (*ZpowEngine) APIs

func (engine *ZpowEngine) APIs(chain consensus.ChainReader) []rpc.API

APIs returns the miner rpc apis

func (*ZpowEngine) Prepare

func (engine *ZpowEngine) Prepare(reader consensus.ChainReader, header *types.BlockHeader) error

Prepare sets the difficulty for the block to be mined

func (*ZpowEngine) Seal

func (engine *ZpowEngine) Seal(reader consensus.ChainReader, block *types.Block, stop <-chan struct{}, results chan<- *types.Block) error

Seal partitions the nonces for the threads and let the threads mine in parallel

func (*ZpowEngine) SetGpuBlocksThreads

func (engine *ZpowEngine) SetGpuBlocksThreads(blocks int, threads int)

func (*ZpowEngine) SetThreads

func (engine *ZpowEngine) SetThreads(threads int)

SetThreads sets the number of threads used for mining

func (*ZpowEngine) StartMining

func (engine *ZpowEngine) StartMining(block *types.Block, seed uint64, min uint64, max uint64, result chan<- *types.Block, abort <-chan struct{},
	isNonceFound *int32, once *sync.Once, detrate metrics.Meter, log *log.ScdoLog)

func (*ZpowEngine) StartMiningGpu

func (engine *ZpowEngine) StartMiningGpu(block *types.Block, seed uint64, min uint64, max uint64, result chan<- *types.Block, abort <-chan struct{},
	isNonceFound *int32, once *sync.Once, detrate metrics.Meter, log *log.ScdoLog)

StartMining is the core mining rountine

func (*ZpowEngine) VerifyHeader

func (engine *ZpowEngine) VerifyHeader(reader consensus.ChainReader, header *types.BlockHeader) error

VerifyHeader validates the specified header and returns error if validation failed.

Jump to

Keyboard shortcuts

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