We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 120fb79 commit 8b8c926Copy full SHA for 8b8c926
1 file changed
trie/hasher.go
@@ -113,18 +113,18 @@ func (h *hasher) hashFullNodeChildren(n *fullNode) *fullNode {
113
var children [17]node
114
if h.parallel {
115
var wg sync.WaitGroup
116
- wg.Add(16)
117
for i := 0; i < 16; i++ {
118
- go func(i int) {
119
- hasher := newHasher(false)
120
- if child := n.Children[i]; child != nil {
+ if child := n.Children[i]; child != nil {
+ wg.Add(1)
+ go func(i int) {
+ hasher := newHasher(false)
121
children[i] = hasher.hash(child, false)
122
- } else {
123
- children[i] = nilValueNode
124
- }
125
- returnHasherToPool(hasher)
126
- wg.Done()
127
- }(i)
+ returnHasherToPool(hasher)
+ wg.Done()
+ }(i)
+ } else {
+ children[i] = nilValueNode
+ }
128
}
129
wg.Wait()
130
} else {
0 commit comments