miner: fix data race in tests (#20310)
* miner: fix data race in tests miner: fix linter * miner: address comment
This commit is contained in:
committed by
Péter Szilágyi
parent
f71e85b8e2
commit
9b59c75405
@ -176,7 +176,7 @@ type worker struct {
|
||||
resubmitHook func(time.Duration, time.Duration) // Method to call upon updating resubmitting interval.
|
||||
}
|
||||
|
||||
func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, isLocalBlock func(*types.Block) bool) *worker {
|
||||
func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, isLocalBlock func(*types.Block) bool, init bool) *worker {
|
||||
worker := &worker{
|
||||
config: config,
|
||||
chainConfig: chainConfig,
|
||||
@ -219,8 +219,9 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus
|
||||
go worker.taskLoop()
|
||||
|
||||
// Submit first work to initialize pending state.
|
||||
worker.startCh <- struct{}{}
|
||||
|
||||
if init {
|
||||
worker.startCh <- struct{}{}
|
||||
}
|
||||
return worker
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user