Browse Source

Group (code,data,log) return values into types.Result

pull/206/merge
Jae Kwon 9 years ago
parent
commit
de6f76758d
2 changed files with 7 additions and 8 deletions
  1. +3
    -4
      mempool/mempool_test.go
  2. +4
    -4
      proxy/local_app_conn.go

+ 3
- 4
mempool/mempool_test.go View File

@ -9,7 +9,6 @@ import (
"github.com/tendermint/tendermint/proxy"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/tmsp/example/counter"
tmsp "github.com/tendermint/tmsp/types"
)
func init() {
@ -70,10 +69,10 @@ func TestSerialReap(t *testing.T) {
for i := start; i < end; i++ {
txBytes := make([]byte, 8)
binary.BigEndian.PutUint64(txBytes, uint64(i))
code, result, logStr := appConnCon.AppendTx(txBytes)
if code != tmsp.CodeType_OK {
res := appConnCon.AppendTx(txBytes)
if !res.IsOK() {
t.Errorf("Error committing tx. Code:%v result:%X log:%v",
code, result, logStr)
res.Code, res.Data, res.Log)
}
}
hash, log := appConnCon.Commit()


+ 4
- 4
proxy/local_app_conn.go View File

@ -54,21 +54,21 @@ func (app *localAppConn) SetOptionAsync(key string, value string) *tmspcli.ReqRe
func (app *localAppConn) AppendTxAsync(tx []byte) *tmspcli.ReqRes {
app.mtx.Lock()
code, result, log := app.Application.AppendTx(tx)
res := app.Application.AppendTx(tx)
app.mtx.Unlock()
return app.callback(
tmsp.RequestAppendTx(tx),
tmsp.ResponseAppendTx(code, result, log),
tmsp.ResponseAppendTx(res.Code, res.Data, res.Log),
)
}
func (app *localAppConn) CheckTxAsync(tx []byte) *tmspcli.ReqRes {
app.mtx.Lock()
code, result, log := app.Application.CheckTx(tx)
res := app.Application.CheckTx(tx)
app.mtx.Unlock()
return app.callback(
tmsp.RequestCheckTx(tx),
tmsp.ResponseCheckTx(code, result, log),
tmsp.ResponseCheckTx(res.Code, res.Data, res.Log),
)
}


Loading…
Cancel
Save