Skip to content

Commit

Permalink
refactor: Amend cosmos#13497 (cosmos#13577)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez authored and JeancarloBarrios committed Sep 28, 2024
1 parent eb52c87 commit 1388314
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 @@ -401,7 +401,10 @@ func startInProcess[T types.Application](svrCtx *Context, svrCfg serverconfig.Co

app.RegisterTxService(clientCtx)
app.RegisterTendermintService(clientCtx)
app.RegisterNodeService(clientCtx)

if a, ok := app.(types.ApplicationQueryService); ok {
a.RegisterNodeService(clientCtx)
}
}
return config, nil
}
Expand Down
13 changes: 10 additions & 3 deletions server/types/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,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[T Application] func(log.Logger, corestore.KVStoreWithBatch, io.Writer, AppOptions) T
Expand Down
5 changes: 4 additions & 1 deletion testutil/network/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,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 a, ok := app.(srvtypes.ApplicationQueryService); ok {
Expand Down

0 comments on commit 1388314

Please sign in to comment.