Everything compiles, test proof in dummy app

This commit is contained in:
Ethan Frey
2017-01-17 15:44:41 +01:00
parent 7cd39dafea
commit cfc3f24751
8 changed files with 63 additions and 22 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ type Client interface {
DeliverTxAsync(tx []byte) *ReqRes
CheckTxAsync(tx []byte) *ReqRes
QueryAsync(tx []byte) *ReqRes
ProofAsync(tx []byte) *ReqRes
ProofAsync(key []byte, blockHeight int64) *ReqRes
CommitAsync() *ReqRes
FlushSync() error
@@ -31,7 +31,7 @@ type Client interface {
DeliverTxSync(tx []byte) (res types.Result)
CheckTxSync(tx []byte) (res types.Result)
QuerySync(tx []byte) (res types.Result)
ProofSync(tx []byte) (res types.Result)
ProofSync(key []byte, blockHeight int64) (res types.Result)
CommitSync() (res types.Result)
InitChainAsync(validators []*types.Validator) *ReqRes
+4 -4
View File
@@ -182,8 +182,8 @@ 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)
func (cli *grpcClient) ProofAsync(key []byte, blockHeight int64) *ReqRes {
req := types.ToRequestProof(key, blockHeight)
res, err := cli.client.Proof(context.Background(), req.GetProof(), grpc.FailFast(true))
if err != nil {
cli.StopForError(err)
@@ -310,8 +310,8 @@ 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)
func (cli *grpcClient) ProofSync(key []byte, blockHeight int64) (res types.Result) {
reqres := cli.ProofAsync(key, blockHeight)
if res := cli.checkErrGetResult(); res.IsErr() {
return res
}
+5 -5
View File
@@ -99,12 +99,12 @@ func (app *localClient) QueryAsync(tx []byte) *ReqRes {
)
}
func (app *localClient) ProofAsync(key []byte) *ReqRes {
func (app *localClient) ProofAsync(key []byte, blockHeight int64) *ReqRes {
app.mtx.Lock()
res := app.Application.Proof(key)
res := app.Application.Proof(key, blockHeight)
app.mtx.Unlock()
return app.callback(
types.ToRequestProof(key),
types.ToRequestProof(key, blockHeight),
types.ToResponseQuery(res.Code, res.Data, res.Log),
)
}
@@ -202,9 +202,9 @@ func (app *localClient) QuerySync(query []byte) (res types.Result) {
return res
}
func (app *localClient) ProofSync(key []byte) (res types.Result) {
func (app *localClient) ProofSync(key []byte, blockHeight int64) (res types.Result) {
app.mtx.Lock()
res = app.Application.Proof(key)
res = app.Application.Proof(key, blockHeight)
app.mtx.Unlock()
return res
}
+4 -4
View File
@@ -255,8 +255,8 @@ func (cli *socketClient) QueryAsync(query []byte) *ReqRes {
return cli.queueRequest(types.ToRequestQuery(query))
}
func (cli *socketClient) ProofAsync(key []byte) *ReqRes {
return cli.queueRequest(types.ToRequestProof(key))
func (cli *socketClient) ProofAsync(key []byte, blockHeight int64) *ReqRes {
return cli.queueRequest(types.ToRequestProof(key, blockHeight))
}
func (cli *socketClient) CommitAsync() *ReqRes {
@@ -349,8 +349,8 @@ func (cli *socketClient) QuerySync(query []byte) (res types.Result) {
return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log}
}
func (cli *socketClient) ProofSync(key []byte) (res types.Result) {
reqres := cli.queueRequest(types.ToRequestProof(key))
func (cli *socketClient) ProofSync(key []byte, blockHeight int64) (res types.Result) {
reqres := cli.queueRequest(types.ToRequestProof(key, blockHeight))
cli.FlushSync()
if err := cli.Error(); err != nil {
return types.ErrInternalError.SetLog(err.Error())