@@ -317,7 +317,7 @@ func (ec *Client) getBlock(
317317 return nil , nil , ethereum .NotFound
318318 }
319319
320- // Decode header and transactions.
320+ // Decode header and transactions
321321 var head types.Header
322322 var body rpcBlock
323323 if err := json .Unmarshal (raw , & head ); err != nil {
@@ -332,7 +332,17 @@ func (ec *Client) getBlock(
332332 return nil , nil , fmt .Errorf ("%w: unable to get uncles" , err )
333333 }
334334
335+ // Get all transaction receipts
336+ receipts , err := ec .getBlockReceipts (ctx , body .Hash , body .Transactions )
337+ if err != nil {
338+ return nil , nil , fmt .Errorf ("%w: could not get receipts for %x" , err , body .Hash [:])
339+ }
340+
335341 // Get block traces (not possible to make idempotent block transaction trace requests)
342+ //
343+ // We fetch traces last because we want to avoid limiting the number of other
344+ // block-related data fetches we perform concurrently (we limit the number of
345+ // concurrent traces that are computed to 16 to avoid overwhelming geth).
336346 var traces []* rpcCall
337347 var rawTraces []* rpcRawCall
338348 var addTraces bool
@@ -344,13 +354,7 @@ func (ec *Client) getBlock(
344354 }
345355 }
346356
347- // Get all transaction receipts
348- receipts , err := ec .getBlockReceipts (ctx , body .Hash , body .Transactions )
349- if err != nil {
350- return nil , nil , fmt .Errorf ("%w: could not get receipts for %x" , err , body .Hash [:])
351- }
352-
353- // Convert all txs to formatted txs
357+ // Convert all txs to loaded txs
354358 txs := make ([]* types.Transaction , len (body .Transactions ))
355359 loadedTxs := make ([]* loadedTransaction , len (body .Transactions ))
356360 for i , tx := range body .Transactions {
0 commit comments