Skip to content

Commit

Permalink
fix(server/v2): inject latest height when not provide in grpc query (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe authored Jan 23, 2025
1 parent 3860b2b commit 9fdcd6d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/v2/cometbft/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,6 @@ func (c *consensus[T]) Info(ctx context.Context, _ *abciproto.InfoRequest) (*abc
// Query implements types.Application.
// It is called by cometbft to query application state.
func (c *consensus[T]) Query(ctx context.Context, req *abciproto.QueryRequest) (resp *abciproto.QueryResponse, err error) {
resp, isGRPC, err := c.maybeRunGRPCQuery(ctx, req)
if isGRPC {
return resp, err
}

// when a client did not provide a query height, manually inject the latest
// for modules queries, AppManager does it automatically
if req.Height == 0 {
Expand All @@ -189,6 +184,11 @@ func (c *consensus[T]) Query(ctx context.Context, req *abciproto.QueryRequest) (
req.Height = int64(latestVersion)
}

resp, isGRPC, err := c.maybeRunGRPCQuery(ctx, req)
if isGRPC {
return resp, err
}

// this error most probably means that we can't handle it with a proto message, so
// it must be an app/p2p/store query
path := splitABCIQueryPath(req.Path)
Expand Down

0 comments on commit 9fdcd6d

Please sign in to comment.