@@ -246,40 +246,41 @@ func loadMPT(mptRoot common.Hash, top bool) chan map[string][]byte {
246
246
}
247
247
248
248
func loadZkTrie (zkRoot common.Hash , top , paranoid bool ) chan map [string ][]byte {
249
- parallelismCutoffDepth := 8
250
- zkLeafMap := make (map [string ][]byte , 1000 )
251
- var zkLeafMutex sync.Mutex
252
249
zkDone := make (chan map [string ][]byte )
253
- go func () {
254
- loaderDbs := <- trieLoaders
255
- defer func () {
256
- trieLoaders <- loaderDbs
257
- }()
250
+ /*
251
+ parallelismCutoffDepth := 8
252
+ zkLeafMap := make(map[string][]byte, 1000)
253
+ var zkLeafMutex sync.Mutex
254
+ go func() {
255
+ loaderDbs := <-trieLoaders
256
+ defer func() {
257
+ trieLoaders <- loaderDbs
258
+ }()
258
259
259
- zkTrie , err := trie .NewZkTrie (zkRoot , trie .NewZktrieDatabaseFromTriedb (trie .NewDatabaseWithConfig (loaderDbs .zkDb , & trie.Config {Preimages : true })))
260
- panicOnError (err , zkRoot .Hex (), "failed to create zk trie" )
260
+ zkTrie, err := trie.NewZkTrie(zkRoot, trie.NewZktrieDatabaseFromTriedb(trie.NewDatabaseWithConfig(loaderDbs.zkDb, &trie.Config{Preimages: true})))
261
+ panicOnError(err, zkRoot.Hex(), "failed to create zk trie")
261
262
262
- zkTrie .CountLeaves (func (key , value []byte ) {
263
- preimageKey := zkTrie .GetKey (key )
264
- if len (preimageKey ) == 0 {
265
- panic (fmt .Sprintf ("preimage not found zk trie %s" , hex .EncodeToString (key )))
266
- }
263
+ zkTrie.CountLeaves(func(key, value []byte) {
264
+ preimageKey := zkTrie.GetKey(key)
265
+ if len(preimageKey) == 0 {
266
+ panic(fmt.Sprintf("preimage not found zk trie %s", hex.EncodeToString(key)))
267
+ }
267
268
268
- zkLeafMutex .Lock ()
269
- zkLeafMap [string (dup (preimageKey ))] = value
270
- zkLeafMutex .Unlock ()
269
+ zkLeafMutex.Lock()
270
+ zkLeafMap[string(dup(preimageKey))] = value
271
+ zkLeafMutex.Unlock()
271
272
272
- if top && len (zkLeafMap )% 10000 == 0 {
273
- fmt .Println ("ZK Accounts Loaded:" , len (zkLeafMap ))
274
- }
275
- }, func (f func ()) {
276
- tempDb := <- trieLoaders
277
- go func () {
278
- trieLoaders <- tempDb
279
- f ()
280
- }()
281
- }, parallelismCutoffDepth , paranoid )
282
- zkDone <- zkLeafMap
283
- }()
273
+ if top && len(zkLeafMap)%10000 == 0 {
274
+ fmt.Println("ZK Accounts Loaded:", len(zkLeafMap))
275
+ }
276
+ }, func(f func()) {
277
+ tempDb := <-trieLoaders
278
+ go func() {
279
+ trieLoaders <- tempDb
280
+ f()
281
+ }()
282
+ }, parallelismCutoffDepth, paranoid)
283
+ zkDone <- zkLeafMap
284
+ }()*/
284
285
return zkDone
285
286
}
0 commit comments