Documentation ¶
Overview ¶
Package miner provides proof-of-work mining capability
Index ¶
Constants ¶
View Source
const ( // EventWorkerFoundBlock indicates that a worker found a block EventWorkerFoundBlock = "event.workerFoundBlock" // HashrateMAWindow is the moving average window // within which ticks are collected to calculate // the average hashrate HashrateMAWindow = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FoundBlock ¶
type FoundBlock struct { WorkerID int Block types.Block Nonce uint64 Started time.Time Finished time.Time }
FoundBlock represents a block with a valid nonce
type Miner ¶
Miner provides proof-of-work computation, difficulty calculation and prepares a mine block for processing.
func NewMiner ¶
func NewMiner(mineKey *crypto.Key, blockMaker types.BlockMaker, event *emitter.Emitter, cfg *config.EngineConfig, log logger.Logger) *Miner
NewMiner creates a Miner instance
func (*Miner) RestartWorkers ¶
RestartWorkers restarts workers. Any previous task is immediately dropped and a new block is proposed and worked on
func (*Miner) SetNumThreads ¶
SetNumThreads sets the number of threads performing PoW computation
Click to show internal directories.
Click to hide internal directories.