@@ -20,7 +20,7 @@ import (
20
20
)
21
21
22
22
var accountsDone atomic.Uint64
23
- var trieCheckers = make ( chan struct {}, runtime . GOMAXPROCS ( 0 ) * 4 )
23
+ var trieCheckers chan struct {}
24
24
25
25
type dbs struct {
26
26
zkDb * leveldb.Database
@@ -29,11 +29,12 @@ type dbs struct {
29
29
30
30
func main () {
31
31
var (
32
- mptDbPath = flag .String ("mpt-db" , "" , "path to the MPT node DB" )
33
- zkDbPath = flag .String ("zk-db" , "" , "path to the ZK node DB" )
34
- mptRoot = flag .String ("mpt-root" , "" , "root hash of the MPT node" )
35
- zkRoot = flag .String ("zk-root" , "" , "root hash of the ZK node" )
36
- paranoid = flag .Bool ("paranoid" , false , "verifies all node contents against their expected hash" )
32
+ mptDbPath = flag .String ("mpt-db" , "" , "path to the MPT node DB" )
33
+ zkDbPath = flag .String ("zk-db" , "" , "path to the ZK node DB" )
34
+ mptRoot = flag .String ("mpt-root" , "" , "root hash of the MPT node" )
35
+ zkRoot = flag .String ("zk-root" , "" , "root hash of the ZK node" )
36
+ paranoid = flag .Bool ("paranoid" , false , "verifies all node contents against their expected hash" )
37
+ parallelismMultipler = flag .Int ("parallelism-multiplier" , 4 , "multiplier for the number of parallel workers" )
37
38
)
38
39
flag .Parse ()
39
40
@@ -45,7 +46,9 @@ func main() {
45
46
zkRootHash := common .HexToHash (* zkRoot )
46
47
mptRootHash := common .HexToHash (* mptRoot )
47
48
48
- for i := 0 ; i < runtime .GOMAXPROCS (0 )* 4 ; i ++ {
49
+ numTrieCheckers := runtime .GOMAXPROCS (0 ) * (* parallelismMultipler )
50
+ trieCheckers = make (chan struct {}, numTrieCheckers )
51
+ for i := 0 ; i < numTrieCheckers ; i ++ {
49
52
trieCheckers <- struct {}{}
50
53
}
51
54
@@ -68,7 +71,7 @@ func main() {
68
71
mptDb : mptDb ,
69
72
}, zkRootHash , mptRootHash , "" , checkAccountEquality , true , * paranoid )
70
73
71
- for i := 0 ; i < runtime . GOMAXPROCS ( 0 ) * 4 ; i ++ {
74
+ for i := 0 ; i < numTrieCheckers ; i ++ {
72
75
<- trieCheckers
73
76
}
74
77
}
0 commit comments