Skip to content

Commit f752cef

Browse files
fix(ethereum): avoid tx decoding in block lookup
1 parent 941b3ef commit f752cef

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

pkg/chain/ethereum/ethereum.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,14 @@ func (bc *baseChain) blockByNumber(number uint64) (*types.Block, error) {
448448
ctx, cancelCtx := context.WithTimeout(context.Background(), 30*time.Second)
449449
defer cancelCtx()
450450

451-
return bc.client.BlockByNumber(ctx, big.NewInt(int64(number)))
451+
// Fetch the header to avoid decoding full transactions (some providers
452+
// may return transaction types the client library does not support yet).
453+
header, err := bc.client.HeaderByNumber(ctx, big.NewInt(int64(number)))
454+
if err != nil {
455+
return nil, err
456+
}
457+
458+
return types.NewBlockWithHeader(header), nil
452459
}
453460

454461
// headerByNumber returns the header for the given block number. Times out

0 commit comments

Comments
 (0)