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