perf(miner): reduce rawdb calls for getting StartL1QueueIndex when inniting environment (#550)

Reduce rawdb calls
This commit is contained in:
DongXi Huang 2023-11-08 21:40:20 +08:00 committed by GitHub
parent 441212200a
commit a8a9dc83cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -813,14 +813,7 @@ func (w *worker) makeCurrent(parent *types.Block, header *types.Header) error {
env.tcount = 0 env.tcount = 0
env.blockSize = 0 env.blockSize = 0
env.l1TxCount = 0 env.l1TxCount = 0
env.nextL1MsgIndex = traceEnv.StartL1QueueIndex
// find next L1 message queue index
nextQueueIndex := rawdb.ReadFirstQueueIndexNotInL2Block(w.eth.ChainDb(), parent.Hash())
if nextQueueIndex == nil {
// the parent must have been processed before we start a new mining job.
log.Crit("Failed to read last L1 message in L2 block", "parent.Hash()", parent.Hash().String())
}
env.nextL1MsgIndex = *nextQueueIndex
// Swap out the old work with the new one, terminating any leftover prefetcher // Swap out the old work with the new one, terminating any leftover prefetcher
// processes in the mean time and starting a new one. // processes in the mean time and starting a new one.