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:
co-authored by
Hieu Vu
Hieu Vu
Julien Robert
parent
5bb5c457b0
commit
d67d6a275b
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user