re-enable prefetcher in miner. make prefetcher schedule async notify

This commit is contained in:
Jared Wasinger 2023-12-20 08:03:28 +08:00
parent 42836bfe97
commit 9dc20080d5
2 changed files with 6 additions and 3 deletions

View file

@ -245,7 +245,10 @@ func (sf *subfetcher) schedule(keys [][]byte) {
sf.tasks = append(sf.tasks, keys...)
sf.lock.Unlock()
// Notify the prefetcher. The wake-chan is buffered, so this is async.
sf.wake <- true
select {
case sf.wake <- true:
default:
}
}
// wait waits for the subfetcher to finish it's task. It is safe to call wait multiple

View file

@ -125,7 +125,7 @@ func (env *environment) discard() {
if env.state == nil {
return
}
//env.state.StopPrefetcher()
env.state.StopPrefetcher()
}
// task contains all information for consensus engine sealing and result submitting.
@ -711,7 +711,7 @@ func (w *worker) makeEnv(parent *types.Header, header *types.Header, coinbase co
if err != nil {
return nil, err
}
//state.StartPrefetcher("miner")
state.StartPrefetcher("miner")
// Note the passed coinbase may be different with header.Coinbase.
env := &environment{