Skip to content

Commit

Permalink
refactor: Amend #13497 (#13577)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez committed Oct 18, 2022
1 parent 86e8bcb commit 8667eba
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
5 changes: 4 additions & 1 deletion server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 10 additions & 3 deletions server/types/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion testutil/network/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down

0 comments on commit 8667eba

Please sign in to comment.