CommitSync returns tmsp.Result

This commit is contained in:
Jae Kwon
2016-03-23 02:50:29 -07:00
parent 5a3975d54a
commit 6785b9a3b6
10 changed files with 82 additions and 50 deletions
+5 -5
View File
@@ -43,7 +43,7 @@ func (app *CounterApplication) AppendTx(tx []byte) types.Result {
}
}
app.txCount += 1
return types.NewResultOK(nil, "")
return types.OK
}
func (app *CounterApplication) CheckTx(tx []byte) types.Result {
@@ -59,18 +59,18 @@ func (app *CounterApplication) CheckTx(tx []byte) types.Result {
}
}
}
return types.NewResultOK(nil, "")
return types.OK
}
func (app *CounterApplication) Commit() (hash []byte, log string) {
func (app *CounterApplication) Commit() types.Result {
app.hashCount += 1
if app.txCount == 0 {
return nil, ""
return types.OK
} else {
hash := make([]byte, 8)
binary.BigEndian.PutUint64(hash, uint64(app.txCount))
return hash, ""
return types.NewResultOK(hash, "")
}
}
+5 -5
View File
@@ -35,16 +35,16 @@ func (app *DummyApplication) AppendTx(tx []byte) types.Result {
} else {
app.state.Set(tx, tx)
}
return types.NewResultOK(nil, "")
return types.OK
}
func (app *DummyApplication) CheckTx(tx []byte) types.Result {
return types.NewResultOK(nil, "")
return types.OK
}
func (app *DummyApplication) Commit() (hash []byte, log string) {
hash = app.state.Hash()
return hash, ""
func (app *DummyApplication) Commit() types.Result {
hash := app.state.Hash()
return types.NewResultOK(hash, "")
}
func (app *DummyApplication) Query(query []byte) types.Result {
+2 -2
View File
@@ -27,8 +27,8 @@ func (app *NilApplication) CheckTx(tx []byte) types.Result {
return types.NewResultOK(nil, "")
}
func (app *NilApplication) Commit() (hash []byte, log string) {
return []byte("nil"), ""
func (app *NilApplication) Commit() types.Result {
return types.NewResultOK([]byte("nil"), "")
}
func (app *NilApplication) Query(query []byte) types.Result {