fix: avoid broadcasting tx through query (#15044)

This commit is contained in:
Facundo Medica 2023-02-16 12:13:23 -03:00 committed by GitHub
parent 407c7572b9
commit c884e276f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -520,6 +520,10 @@ func (app *BaseApp) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
telemetry.IncrCounter(1, "query", req.Path)
defer telemetry.MeasureSince(time.Now(), req.Path)
if req.Path == "/cosmos.tx.v1beta1.Service/BroadcastTx" {
return sdkerrors.QueryResult(sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "can't route a broadcast tx message"), app.trace)
}
// handle gRPC routes first rather than calling splitPath because '/' characters
// are used as part of gRPC paths
if grpcHandler := app.grpcQueryRouter.Route(req.Path); grpcHandler != nil {