uint worker count

This commit is contained in:
Roy Crihfield 2023-08-25 18:49:31 +08:00
parent a9ebc41b3d
commit 95b6edd1a4

View File

@ -49,7 +49,7 @@ var (
nullCodeHash = crypto.Keccak256([]byte{})
zeroHash common.Hash
defaultSubtrieWorkers = 8
defaultSubtrieWorkers uint = 8
)
// Builder interface exposes the method for building a state diff between two blocks
@ -61,7 +61,7 @@ type Builder interface {
type StateDiffBuilder struct {
// state cache is safe for concurrent reads
stateCache adapt.StateView
subtrieWorkers int
subtrieWorkers uint
}
type accountUpdate struct {
@ -134,8 +134,8 @@ func (sdb *StateDiffBuilder) WriteStateDiff(
logger := log.New("hash", args.BlockHash, "number", args.BlockNumber)
// errgroup will cancel if any gr fails
g, ctx := errgroup.WithContext(context.Background())
for i := 0; i < sdb.subtrieWorkers; i++ {
func(subdiv int) {
for i := uint(0); i < sdb.subtrieWorkers; i++ {
func(subdiv uint) {
g.Go(func() error {
a, b := subitersA[subdiv], subitersB[subdiv]
return sdb.processAccounts(ctx,