Skip to content

Commit

Permalink
add useSerialProcessor condition
Browse files Browse the repository at this point in the history
  • Loading branch information
welkin22 committed Dec 25, 2024
1 parent 191ba74 commit 2a5dd36
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
log.Info("Parallel V2 enabled", "parallelNum", ParallelNum())
} else {
bc.processor = NewStateProcessor(chainConfig, bc, engine)
bc.serialProcessor = bc.processor
}
// Start future block processor.
bc.wg.Add(1)
Expand Down Expand Up @@ -2017,14 +2018,13 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error)

// Process block using the parent state as reference point
pstart = time.Now()
useSerialProcessor := bc.vmConfig.TxDAG == nil && (bc.vmConfig.EnableParallelUnorderedMerge || bc.vmConfig.EnableTxParallelMerge)
txDAGMissButNecessary := bc.vmConfig.TxDAG == nil && (bc.vmConfig.EnableParallelUnorderedMerge || bc.vmConfig.EnableTxParallelMerge)
useSerialProcessor := !bc.vmConfig.EnableParallelExec || txDAGMissButNecessary
if useSerialProcessor {
receipts, logs, usedGas, err = bc.serialProcessor.Process(block, statedb, bc.vmConfig)
blockProcessedInParallel = false
} else {
if bc.vmConfig.EnableParallelExec {
parallelEnableMeter.Mark(1)
}
parallelEnableMeter.Mark(1)
receipts, logs, usedGas, err = bc.processor.Process(block, statedb, bc.vmConfig)
blockProcessedInParallel = true
if err != nil {
Expand Down

0 comments on commit 2a5dd36

Please sign in to comment.