diff --git a/server/start.go b/server/start.go index 2a2a1af88..b8565a87a 100644 --- a/server/start.go +++ b/server/start.go @@ -252,12 +252,20 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App } ctx.Logger.Debug("Initialization: tmNode started") - // Add the tx service to the gRPC router. - app.RegisterTxService(clientCtx) + config := config.GetConfig(ctx.Viper) + + // Add the tx service to the gRPC router. We only need to register this + // service if API or gRPC is enabled, and avoid doing so in the general + // case, because it spawns a new local tendermint RPC client. + if config.API.Enable || config.GRPC.Enable { + clientCtx = clientCtx. + WithClient(local.New(tmNode)) + + app.RegisterTxService(clientCtx) + } var apiSrv *api.Server - config := config.GetConfig(ctx.Viper) if config.API.Enable { genDoc, err := genDocProvider() if err != nil { @@ -266,8 +274,7 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App clientCtx := clientCtx. WithHomeDir(home). - WithChainID(genDoc.ChainID). - WithClient(local.New(tmNode)) + WithChainID(genDoc.ChainID) apiSrv = api.New(clientCtx, ctx.Logger.With("module", "api-server")) app.RegisterAPIRoutes(apiSrv, config.API)