@@ -242,9 +242,7 @@ func (t *trieView) calculateNodeIDs(ctx context.Context) error {
242242 // [eg] limits the number of goroutines we start.
243243 var eg errgroup.Group
244244 eg .SetLimit (t .db .rootGenConcurrency )
245- if err = t .calculateNodeIDsHelper (ctx , t .root , & eg ); err != nil {
246- return
247- }
245+ t .calculateNodeIDsHelper (ctx , t .root , & eg )
248246 if err = eg .Wait (); err != nil {
249247 return
250248 }
@@ -261,7 +259,7 @@ func (t *trieView) calculateNodeIDs(ctx context.Context) error {
261259
262260// Calculates the ID of all descendants of [n] which need to be recalculated,
263261// and then calculates the ID of [n] itself.
264- func (t * trieView ) calculateNodeIDsHelper (ctx context.Context , n * node , eg * errgroup.Group ) error {
262+ func (t * trieView ) calculateNodeIDsHelper (ctx context.Context , n * node , eg * errgroup.Group ) {
265263 var (
266264 // We use [wg] to wait until all descendants of [n] have been updated.
267265 // Note we can't wait on [eg] because [eg] may have started goroutines
@@ -281,24 +279,22 @@ func (t *trieView) calculateNodeIDsHelper(ctx context.Context, n *node, eg *errg
281279 }
282280
283281 wg .Add (1 )
284- updateChild := func () error {
282+ updateChild := func () {
285283 defer wg .Done ()
286284
287- if err := t .calculateNodeIDsHelper (ctx , childNodeChange .after , eg ); err != nil {
288- return err
289- }
285+ t .calculateNodeIDsHelper (ctx , childNodeChange .after , eg )
290286
291287 // Note that this will never block
292288 updatedChildren <- childNodeChange .after
293- return nil
294289 }
295290
296291 // Try updating the child and its descendants in a goroutine.
297- if ok := eg .TryGo (updateChild ); ! ok {
292+ if ok := eg .TryGo (func () error {
293+ updateChild ()
294+ return nil
295+ }); ! ok {
298296 // We're at the goroutine limit; do the work in this goroutine.
299- if err := updateChild (); err != nil {
300- return err
301- }
297+ updateChild ()
302298 }
303299 }
304300
@@ -311,7 +307,7 @@ func (t *trieView) calculateNodeIDsHelper(ctx context.Context, n *node, eg *errg
311307 }
312308
313309 // The IDs [n]'s descendants are up to date so we can calculate [n]'s ID.
314- return n .calculateID (t .db .metrics )
310+ n .calculateID (t .db .metrics )
315311}
316312
317313// GetProof returns a proof that [bytesPath] is in or not in trie [t].
0 commit comments