Begin adding proof calls

This commit is contained in:
Ethan Frey
2017-01-10 15:49:26 +01:00
parent 98c4679f39
commit 58ea995032
14 changed files with 131 additions and 2 deletions

View File

@ -182,6 +182,15 @@ func (cli *grpcClient) QueryAsync(query []byte) *ReqRes {
return cli.finishAsyncCall(req, &types.Response{&types.Response_Query{res}})
}
func (cli *grpcClient) ProofAsync(key []byte) *ReqRes {
req := types.ToRequestProof(key)
res, err := cli.client.Proof(context.Background(), req.GetProof(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
}
return cli.finishAsyncCall(req, &types.Response{&types.Response_Proof{res}})
}
func (cli *grpcClient) CommitAsync() *ReqRes {
req := types.ToRequestCommit()
res, err := cli.client.Commit(context.Background(), req.GetCommit(), grpc.FailFast(true))
@ -301,6 +310,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) ProofSync(key []byte) (res types.Result) {
reqres := cli.ProofAsync(key)
if res := cli.checkErrGetResult(); res.IsErr() {
return res
}
resp := reqres.Response.GetProof()
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() {