diff --git a/beacon-chain/gateway/gateway.go b/beacon-chain/gateway/gateway.go index 5c71dff29..db1a379b5 100644 --- a/beacon-chain/gateway/gateway.go +++ b/beacon-chain/gateway/gateway.go @@ -151,7 +151,7 @@ func (g *Gateway) dial(ctx context.Context, network, addr string) (*grpc.ClientC case "tcp": return g.dialTCP(ctx, addr) case "unix": - return dialUnix(ctx, addr) + return g.dialUnix(ctx, addr) default: return nil, fmt.Errorf("unsupported network type %q", network) } @@ -160,10 +160,9 @@ func (g *Gateway) dial(ctx context.Context, network, addr string) (*grpc.ClientC // dialTCP creates a client connection via TCP. // "addr" must be a valid TCP address with a port number. func (g *Gateway) dialTCP(ctx context.Context, addr string) (*grpc.ClientConn, error) { - opts := []grpc.DialOption{grpc.WithInsecure()} - - if g.enableDebugRPCEndpoints { - opts = append(opts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(int(g.maxCallRecvMsgSize)))) + opts := []grpc.DialOption{ + grpc.WithInsecure(), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(int(g.maxCallRecvMsgSize))), } return grpc.DialContext( @@ -175,9 +174,14 @@ func (g *Gateway) dialTCP(ctx context.Context, addr string) (*grpc.ClientConn, e // dialUnix creates a client connection via a unix domain socket. // "addr" must be a valid path to the socket. -func dialUnix(ctx context.Context, addr string) (*grpc.ClientConn, error) { +func (g *Gateway) dialUnix(ctx context.Context, addr string) (*grpc.ClientConn, error) { d := func(addr string, timeout time.Duration) (net.Conn, error) { return net.DialTimeout("unix", addr, timeout) } - return grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithDialer(d)) + opts := []grpc.DialOption{ + grpc.WithInsecure(), + grpc.WithDialer(d), + grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(int(g.maxCallRecvMsgSize))), + } + return grpc.DialContext(ctx, addr, opts...) }