@@ -458,56 +458,6 @@ func interruptRequested(interrupted <-chan struct{}) bool {
458458 return false
459459}
460460
461- func (ct * ClaimTrie ) makeNameHashNext (names [][]byte , all bool , interrupt <- chan struct {}) chan NameHashNext {
462- inputs := make (chan []byte , 512 )
463- outputs := make (chan NameHashNext , 512 )
464-
465- var wg sync.WaitGroup
466- hashComputationWorker := func () {
467- for name := range inputs {
468- hash , next := ct .nodeManager .Hash (name )
469- outputs <- NameHashNext {name , hash , next }
470- }
471- wg .Done ()
472- }
473-
474- threads := int (0.8 * float32 (runtime .NumCPU ()))
475- if threads < 1 {
476- threads = 1
477- }
478- for threads > 0 {
479- threads --
480- wg .Add (1 )
481- go hashComputationWorker ()
482- }
483- go func () {
484- if all {
485- ct .nodeManager .IterateNames (func (name []byte ) bool {
486- if interruptRequested (interrupt ) {
487- return false
488- }
489- clone := make ([]byte , len (name ))
490- copy (clone , name ) // iteration name buffer is reused on future loops
491- inputs <- clone
492- return true
493- })
494- } else {
495- for _ , name := range names {
496- if interruptRequested (interrupt ) {
497- break
498- }
499- inputs <- name
500- }
501- }
502- close (inputs )
503- }()
504- go func () {
505- wg .Wait ()
506- close (outputs )
507- }()
508- return outputs
509- }
510-
511461func (ct * ClaimTrie ) MerklePath (name []byte , n * node.Node , bid int ) []merkletrie.HashSidePair {
512462 pairs := ct .merkleTrie .MerklePath (name )
513463 // TODO: organize this code better
0 commit comments