diff --git a/server/start.go b/server/start.go index 1d561f2ae75b..37acd3408a54 100644 --- a/server/start.go +++ b/server/start.go @@ -334,7 +334,10 @@ func startInProcess(ctx *Context, clientCtx client.Context, appCreator types.App app.RegisterTxService(clientCtx) app.RegisterTendermintService(clientCtx) - app.RegisterNodeService(clientCtx) + + if a, ok := app.(types.ApplicationQueryService); ok { + a.RegisterNodeService(clientCtx) + } } metrics, err := startTelemetry(config) diff --git a/server/types/app.go b/server/types/app.go index 6962c1af42ef..abc4c739e5bb 100644 --- a/server/types/app.go +++ b/server/types/app.go @@ -53,13 +53,20 @@ type ( // RegisterTendermintService registers the gRPC Query service for tendermint queries. RegisterTendermintService(client.Context) - // RegisterNodeService registers the node gRPC Query service. - RegisterNodeService(client.Context) - // Return the multistore instance CommitMultiStore() sdk.CommitMultiStore } + // ApplicationQueryService defines an extension of the Application interface + // that facilitates gRPC query Services. + // + // NOTE: This interfaces exists only in the v0.46.x line to ensure the existing + // Application interface does not introduce API breaking changes. + ApplicationQueryService interface { + // RegisterNodeService registers the node gRPC Query service. + RegisterNodeService(client.Context) + } + // AppCreator is a function that allows us to lazily initialize an // application using various configurations. AppCreator func(log.Logger, dbm.DB, io.Writer, AppOptions) Application diff --git a/testutil/network/util.go b/testutil/network/util.go index 3401aaa9e70a..a29705c0fa38 100644 --- a/testutil/network/util.go +++ b/testutil/network/util.go @@ -72,7 +72,10 @@ func startInProcess(cfg Config, val *Validator) error { app.RegisterTxService(val.ClientCtx) app.RegisterTendermintService(val.ClientCtx) - app.RegisterNodeService(val.ClientCtx) + + if a, ok := app.(srvtypes.ApplicationQueryService); ok { + a.RegisterNodeService(val.ClientCtx) + } } if val.APIAddress != "" {