Documentation ¶
Index ¶
- func StartMining(block *types.Block, seed uint64, min uint64, max uint64, ...)
- type API
- type Engine
- func (engine *Engine) APIs(chain consensus.ChainReader) []rpc.API
- func (engine *Engine) Prepare(reader consensus.ChainReader, header *types.BlockHeader) error
- func (engine *Engine) Seal(reader consensus.ChainReader, block *types.Block, stop <-chan struct{}, ...) error
- func (engine *Engine) SetThreads(threads int)
- func (engine *Engine) VerifyHeader(reader consensus.ChainReader, header *types.BlockHeader) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartMining ¶
func StartMining(block *types.Block, seed uint64, min uint64, max uint64, result chan<- *types.Block, abort <-chan struct{}, isNonceFound *int32, once *sync.Once, hashrate metrics.Meter, log *log.SeeleLog)
StartMining starts calculating the nonce for the block. seed is the random start value for the nonce min is the min number for the nonce per thread max is the max number for the nonce per thread result represents the founded nonce will be set in the result block abort is a channel by closing which you can stop mining isNonceFound is a flag to mark nonce is found by other threads hashrate is the average hashrate of miner
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func (*API) GetHashrate ¶
GetHashrate returns the current hashrate for local CPU miner and remote miner.
func (*API) GetThreads ¶
GetThreads returns the thread number of the miner engine
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine provides the consensus operations based on POW.
func (*Engine) Prepare ¶
func (engine *Engine) Prepare(reader consensus.ChainReader, header *types.BlockHeader) error
func (*Engine) SetThreads ¶
func (*Engine) VerifyHeader ¶
func (engine *Engine) VerifyHeader(reader consensus.ChainReader, header *types.BlockHeader) error
ValidateHeader validates the specified header and returns error if validation failed.