makeCurrentWork creates a new environment for the current cycle.
(parent *types.Block, header *types.Header)
| 352 | |
| 353 | // makeCurrentWork creates a new environment for the current cycle. |
| 354 | func (e *engine) makeCurrentWork(parent *types.Block, header *types.Header) error { |
| 355 | pubState, err := e.chain.StateAt(parent.StateRoot()) |
| 356 | if err != nil { |
| 357 | return err |
| 358 | } |
| 359 | |
| 360 | privState, err := e.chain.StatePrivAt(parent.StateRoot()) |
| 361 | if err != nil { |
| 362 | return err |
| 363 | } |
| 364 | |
| 365 | work := &Work{ |
| 366 | config: e.config, |
| 367 | signer: types.NewCep1Signer(e.config.ChainID), |
| 368 | pubState: pubState, |
| 369 | privState: privState, |
| 370 | header: header, |
| 371 | createdAt: time.Now(), |
| 372 | remoteDB: e.chain.RemoteDB(), |
| 373 | accm: e.backend.AccountManager(), |
| 374 | } |
| 375 | |
| 376 | // Keep track of transactions which return errors so they can be removed |
| 377 | work.tcount = 0 |
| 378 | e.currentWork = work |
| 379 | return nil |
| 380 | } |
| 381 | |
| 382 | // commitNewWork creates a new block. Calling this function multiple times will abort the previous work on workers. |
| 383 | func (e *engine) commitNewWork() { |
no test coverage detected