mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-18 22:14:35 +00:00
Merge branch 'abci_proof' into develop
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ type Client interface {
|
||||
SetOptionAsync(key string, value string) *ReqRes
|
||||
DeliverTxAsync(tx []byte) *ReqRes
|
||||
CheckTxAsync(tx []byte) *ReqRes
|
||||
QueryAsync(tx []byte) *ReqRes
|
||||
QueryAsync(reqQuery types.RequestQuery) *ReqRes
|
||||
CommitAsync() *ReqRes
|
||||
|
||||
FlushSync() error
|
||||
@@ -29,7 +29,7 @@ type Client interface {
|
||||
SetOptionSync(key string, value string) (res types.Result)
|
||||
DeliverTxSync(tx []byte) (res types.Result)
|
||||
CheckTxSync(tx []byte) (res types.Result)
|
||||
QuerySync(tx []byte) (res types.Result)
|
||||
QuerySync(reqQuery types.RequestQuery) (resQuery types.ResponseQuery, err error)
|
||||
CommitSync() (res types.Result)
|
||||
|
||||
InitChainAsync(validators []*types.Validator) *ReqRes
|
||||
|
||||
+11
-9
@@ -173,8 +173,8 @@ func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes {
|
||||
return cli.finishAsyncCall(req, &types.Response{&types.Response_CheckTx{res}})
|
||||
}
|
||||
|
||||
func (cli *grpcClient) QueryAsync(query []byte) *ReqRes {
|
||||
req := types.ToRequestQuery(query)
|
||||
func (cli *grpcClient) QueryAsync(reqQuery types.RequestQuery) *ReqRes {
|
||||
req := types.ToRequestQuery(reqQuery)
|
||||
res, err := cli.client.Query(context.Background(), req.GetQuery(), grpc.FailFast(true))
|
||||
if err != nil {
|
||||
cli.StopForError(err)
|
||||
@@ -255,7 +255,7 @@ func (cli *grpcClient) EchoSync(msg string) (res types.Result) {
|
||||
return res
|
||||
}
|
||||
resp := reqres.Response.GetEcho()
|
||||
return types.NewResultOK([]byte(resp.Message), LOG)
|
||||
return types.NewResultOK([]byte(resp.Message), "")
|
||||
}
|
||||
|
||||
func (cli *grpcClient) FlushSync() error {
|
||||
@@ -300,13 +300,15 @@ func (cli *grpcClient) CheckTxSync(tx []byte) (res types.Result) {
|
||||
return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log}
|
||||
}
|
||||
|
||||
func (cli *grpcClient) QuerySync(query []byte) (res types.Result) {
|
||||
reqres := cli.QueryAsync(query)
|
||||
if res := cli.checkErrGetResult(); res.IsErr() {
|
||||
return res
|
||||
func (cli *grpcClient) QuerySync(reqQuery types.RequestQuery) (resQuery types.ResponseQuery, err error) {
|
||||
reqres := cli.QueryAsync(reqQuery)
|
||||
if err = cli.Error(); err != nil {
|
||||
return resQuery, err
|
||||
}
|
||||
resp := reqres.Response.GetQuery()
|
||||
return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log}
|
||||
if resQuery_ := reqres.Response.GetQuery(); resQuery_ != nil {
|
||||
return *resQuery_, nil
|
||||
}
|
||||
return resQuery, nil
|
||||
}
|
||||
|
||||
func (cli *grpcClient) CommitSync() (res types.Result) {
|
||||
|
||||
@@ -89,13 +89,13 @@ func (app *localClient) CheckTxAsync(tx []byte) *ReqRes {
|
||||
)
|
||||
}
|
||||
|
||||
func (app *localClient) QueryAsync(tx []byte) *ReqRes {
|
||||
func (app *localClient) QueryAsync(reqQuery types.RequestQuery) *ReqRes {
|
||||
app.mtx.Lock()
|
||||
res := app.Application.Query(tx)
|
||||
resQuery := app.Application.Query(reqQuery)
|
||||
app.mtx.Unlock()
|
||||
return app.callback(
|
||||
types.ToRequestQuery(tx),
|
||||
types.ToResponseQuery(res.Code, res.Data, res.Log),
|
||||
types.ToRequestQuery(reqQuery),
|
||||
types.ToResponseQuery(resQuery),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -185,11 +185,11 @@ func (app *localClient) CheckTxSync(tx []byte) (res types.Result) {
|
||||
return res
|
||||
}
|
||||
|
||||
func (app *localClient) QuerySync(query []byte) (res types.Result) {
|
||||
func (app *localClient) QuerySync(reqQuery types.RequestQuery) (resQuery types.ResponseQuery, err error) {
|
||||
app.mtx.Lock()
|
||||
res = app.Application.Query(query)
|
||||
resQuery = app.Application.Query(reqQuery)
|
||||
app.mtx.Unlock()
|
||||
return res
|
||||
return resQuery, nil
|
||||
}
|
||||
|
||||
func (app *localClient) CommitSync() (res types.Result) {
|
||||
|
||||
+12
-10
@@ -249,8 +249,8 @@ func (cli *socketClient) CheckTxAsync(tx []byte) *ReqRes {
|
||||
return cli.queueRequest(types.ToRequestCheckTx(tx))
|
||||
}
|
||||
|
||||
func (cli *socketClient) QueryAsync(query []byte) *ReqRes {
|
||||
return cli.queueRequest(types.ToRequestQuery(query))
|
||||
func (cli *socketClient) QueryAsync(reqQuery types.RequestQuery) *ReqRes {
|
||||
return cli.queueRequest(types.ToRequestQuery(reqQuery))
|
||||
}
|
||||
|
||||
func (cli *socketClient) CommitAsync() *ReqRes {
|
||||
@@ -278,7 +278,7 @@ func (cli *socketClient) EchoSync(msg string) (res types.Result) {
|
||||
return types.ErrInternalError.SetLog(err.Error())
|
||||
}
|
||||
resp := reqres.Response.GetEcho()
|
||||
return types.Result{Code: OK, Data: []byte(resp.Message), Log: LOG}
|
||||
return types.Result{Code: OK, Data: []byte(resp.Message)}
|
||||
}
|
||||
|
||||
func (cli *socketClient) FlushSync() error {
|
||||
@@ -296,8 +296,8 @@ func (cli *socketClient) InfoSync() (resInfo types.ResponseInfo, err error) {
|
||||
if err := cli.Error(); err != nil {
|
||||
return resInfo, err
|
||||
}
|
||||
if info := reqres.Response.GetInfo(); info != nil {
|
||||
return *info, nil
|
||||
if resInfo_ := reqres.Response.GetInfo(); resInfo_ != nil {
|
||||
return *resInfo_, nil
|
||||
}
|
||||
return resInfo, nil
|
||||
}
|
||||
@@ -332,14 +332,16 @@ func (cli *socketClient) CheckTxSync(tx []byte) (res types.Result) {
|
||||
return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log}
|
||||
}
|
||||
|
||||
func (cli *socketClient) QuerySync(query []byte) (res types.Result) {
|
||||
reqres := cli.queueRequest(types.ToRequestQuery(query))
|
||||
func (cli *socketClient) QuerySync(reqQuery types.RequestQuery) (resQuery types.ResponseQuery, err error) {
|
||||
reqres := cli.queueRequest(types.ToRequestQuery(reqQuery))
|
||||
cli.FlushSync()
|
||||
if err := cli.Error(); err != nil {
|
||||
return types.ErrInternalError.SetLog(err.Error())
|
||||
return resQuery, err
|
||||
}
|
||||
resp := reqres.Response.GetQuery()
|
||||
return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log}
|
||||
if resQuery_ := reqres.Response.GetQuery(); resQuery_ != nil {
|
||||
return *resQuery_, nil
|
||||
}
|
||||
return resQuery, nil
|
||||
}
|
||||
|
||||
func (cli *socketClient) CommitSync() (res types.Result) {
|
||||
|
||||
Reference in New Issue
Block a user