tmsp: ResponseInfo and ResponseEndBlock

This commit is contained in:
Ethan Buchman
2017-01-12 15:21:20 -05:00
parent e7a12f8e38
commit 2dd7030579
8 changed files with 45 additions and 50 deletions
+4 -4
View File
@@ -16,7 +16,7 @@ type AppConnConsensus interface {
BeginBlockSync(hash []byte, header *types.Header) (err error)
AppendTxAsync(tx []byte) *tmspcli.ReqRes
EndBlockSync(height uint64) (changedValidators []*types.Validator, err error)
EndBlockSync(height uint64) (types.ResponseEndBlock, error)
CommitSync() (res types.Result)
}
@@ -34,7 +34,7 @@ type AppConnQuery interface {
Error() error
EchoSync(string) (res types.Result)
InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo)
InfoSync() (types.ResponseInfo, error)
QuerySync(tx []byte) (res types.Result)
// SetOptionSync(key string, value string) (res types.Result)
@@ -73,7 +73,7 @@ func (app *appConnConsensus) AppendTxAsync(tx []byte) *tmspcli.ReqRes {
return app.appConn.AppendTxAsync(tx)
}
func (app *appConnConsensus) EndBlockSync(height uint64) (changedValidators []*types.Validator, err error) {
func (app *appConnConsensus) EndBlockSync(height uint64) (types.ResponseEndBlock, error) {
return app.appConn.EndBlockSync(height)
}
@@ -135,7 +135,7 @@ func (app *appConnQuery) EchoSync(msg string) (res types.Result) {
return app.appConn.EchoSync(msg)
}
func (app *appConnQuery) InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
func (app *appConnQuery) InfoSync() (types.ResponseInfo, error) {
return app.appConn.InfoSync()
}
+5 -5
View File
@@ -16,7 +16,7 @@ import (
type AppConnTest interface {
EchoAsync(string) *tmspcli.ReqRes
FlushSync() error
InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo)
InfoSync() (types.ResponseInfo, error)
}
type appConnTest struct {
@@ -35,7 +35,7 @@ func (app *appConnTest) FlushSync() error {
return app.appConn.FlushSync()
}
func (app *appConnTest) InfoSync() (types.Result, *types.TMSPInfo, *types.LastBlockInfo, *types.ConfigInfo) {
func (app *appConnTest) InfoSync() (types.ResponseInfo, error) {
return app.appConn.InfoSync()
}
@@ -114,11 +114,11 @@ func TestInfo(t *testing.T) {
proxy := NewAppConnTest(cli)
t.Log("Connected")
res, _, _, _ := proxy.InfoSync()
if res.IsErr() {
resInfo, err := proxy.InfoSync()
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
if string(res.Data) != "{\"size\":0}" {
if string(resInfo.Data) != "{\"size\":0}" {
t.Error("Expected ResponseInfo with one element '{\"size\":0}' but got something else")
}
}