(config *configs.ChainConfig, cons consensus.Engine, coinbase common.Address, backend Backend, mux *event.TypeMux)
| 119 | } |
| 120 | |
| 121 | func newEngine(config *configs.ChainConfig, cons consensus.Engine, coinbase common.Address, backend Backend, mux *event.TypeMux) *engine { |
| 122 | e := &engine{ |
| 123 | config: config, |
| 124 | cons: cons, |
| 125 | backend: backend, |
| 126 | mux: mux, |
| 127 | txsCh: make(chan core.NewTxsEvent, txChanSize), |
| 128 | chainLatestCh: make(chan core.ChainLatestEvent, chainLatestChanSize), |
| 129 | chainSideCh: make(chan core.ChainSideEvent, chainSideChanSize), |
| 130 | quitCh: make(chan struct{}), |
| 131 | chainDb: backend.ChainDb(), |
| 132 | recv: make(chan *Result, resultQueueSize), |
| 133 | chain: backend.BlockChain(), |
| 134 | proc: backend.BlockChain().Validator(), // processor validator lock |
| 135 | coinbase: coinbase, |
| 136 | workers: make(map[Worker]struct{}), |
| 137 | } |
| 138 | |
| 139 | // initially commit new work to make pending block and snapshot availableklk |
| 140 | if backend.BlockChain().SyncMode() == syncer.FullSync { |
| 141 | go e.update() |
| 142 | e.commitNewWork() |
| 143 | } |
| 144 | return e |
| 145 | } |
| 146 | |
| 147 | func (e *engine) setCoinbase(addr common.Address) { |
| 148 | e.mu.Lock() |
no test coverage detected