@@ -181,7 +181,7 @@ func (w *Worker) syncDiffs(
181181 return fmt .Errorf ("failed to fetch missing block headers: %w" , err ) // Suggestion: databases can fail, consider retrying.
182182 }
183183
184- w .triggerRoundFetches (fetchCtx , & wg , fetchPool , diffCh , syncingRounds , summaryCache , lastFullyAppliedRound + 1 , latestBlockRound )
184+ w .triggerRoundFetches (fetchCtx , fetchPool , diffCh , syncingRounds , summaryCache , lastFullyAppliedRound + 1 , latestBlockRound )
185185 case item := <- diffCh :
186186 if item .err != nil {
187187 w .logger .Error ("error calling getdiff" ,
@@ -199,12 +199,12 @@ func (w *Worker) syncDiffs(
199199 // Item was successfully processed, trigger more round fetches.
200200 // This ensures that new rounds are processed as fast as possible
201201 // when we're syncing and are far behind.
202- w .triggerRoundFetches (fetchCtx , & wg , fetchPool , diffCh , syncingRounds , summaryCache , lastFullyAppliedRound + 1 , latestBlockRound )
202+ w .triggerRoundFetches (fetchCtx , fetchPool , diffCh , syncingRounds , summaryCache , lastFullyAppliedRound + 1 , latestBlockRound )
203203 heartbeat .reset ()
204204 case <- heartbeat .C :
205205 if latestBlockRound != w .undefinedRound {
206206 w .logger .Debug ("heartbeat" , "in_flight_rounds" , len (syncingRounds ))
207- w .triggerRoundFetches (fetchCtx , & wg , fetchPool , diffCh , syncingRounds , summaryCache , lastFullyAppliedRound + 1 , latestBlockRound )
207+ w .triggerRoundFetches (fetchCtx , fetchPool , diffCh , syncingRounds , summaryCache , lastFullyAppliedRound + 1 , latestBlockRound )
208208 }
209209 case finalized := <- finalizedCh :
210210 var err error
@@ -273,7 +273,6 @@ func (w *Worker) fetchMissingBlockHeaders(ctx context.Context, lastFullyAppliedR
273273
274274func (w * Worker ) triggerRoundFetches (
275275 ctx context.Context ,
276- wg * sync.WaitGroup ,
277276 fetchPool * workerpool.Pool ,
278277 diffCh chan <- * fetchedDiff ,
279278 syncingRounds map [uint64 ]* inFlight ,
@@ -329,9 +328,7 @@ func (w *Worker) triggerRoundFetches(
329328 rootType := prevRoots [i ].Type
330329 if ! syncing .outstanding .contains (rootType ) && syncing .awaitingRetry .contains (rootType ) {
331330 syncing .scheduleDiff (rootType )
332- wg .Add (1 )
333331 fetchPool .Submit (func () {
334- defer wg .Done ()
335332 w .fetchDiff (ctx , diffCh , this .Round , prevRoots [i ], this .Roots [i ])
336333 })
337334 }
0 commit comments