push sends a new work task to currently live miner workers.
(work *Work)
| 339 | |
| 340 | // push sends a new work task to currently live miner workers. |
| 341 | func (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. |
| 354 | func (e *engine) makeCurrentWork(parent *types.Block, header *types.Header) error { |