MCPcopy Create free account
hub / github.com/CPChain/chain / push

Method push

miner/engine.go:341–351  ·  view source on GitHub ↗

push sends a new work task to currently live miner workers.

(work *Work)

Source from the content-addressed store, hash-verified

339
340// push sends a new work task to currently live miner workers.
341func (e *engine) push(work *Work) {
342 if atomic.LoadInt32(&e.mining) != 1 {
343 return
344 }
345 for worker := range e.workers {
346 atomic.AddInt32(&e.atWork, 1)
347 if ch := worker.Work(); ch != nil {
348 ch <- work
349 }
350 }
351}
352
353// makeCurrentWork creates a new environment for the current cycle.
354func (e *engine) makeCurrentWork(parent *types.Block, header *types.Header) error {

Callers 1

commitNewWorkMethod · 0.95

Calls 1

WorkMethod · 0.65

Tested by

no test coverage detected