refactor(serevr/v2/cometbft): update RegisterQueryHandlers and GRPC queries (backport #22403) (#22429)

Co-authored-by: Hieu Vu <72878483+hieuvubk@users.noreply.github.com>
Co-authored-by: Hieu Vu <hieuvubk@gmail.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot]
2024-11-05 09:34:57 +01:00
committed by GitHub
co-authored by Hieu Vu Hieu Vu Julien Robert
parent 5bb5c457b0
commit d67d6a275b
3 changed files with 9 additions and 6 deletions
+6 -3
View File
@@ -259,12 +259,15 @@ func (c *Consensus[T]) maybeRunGRPCQuery(ctx context.Context, req *abci.QueryReq
return nil, false, err
}
var handlerFullName string
md, isGRPC := desc.(protoreflect.MethodDescriptor)
if !isGRPC {
return nil, false, nil
handlerFullName = string(desc.FullName())
} else {
handlerFullName = string(md.Input().FullName())
}
handler, found := c.queryHandlersMap[string(md.Input().FullName())]
handler, found := c.queryHandlersMap[handlerFullName]
if !found {
return nil, true, fmt.Errorf("no query handler found for %s", req.Path)
}
@@ -282,7 +285,7 @@ func (c *Consensus[T]) maybeRunGRPCQuery(ctx context.Context, req *abci.QueryReq
}
resp, err = queryResponse(res, req.Height)
return resp, isGRPC, err
return resp, true, err
}
// InitChain implements types.Application.