ABCI message updates (code/log/info)

* Add info to Response[CheckTx/DeliverTx/Query]
* Remove code and log from Response[SetOption/Commit]
This commit is contained in:
Jae Kwon
2017-12-26 15:46:06 -08:00
parent 66580408f8
commit 8f87efd7f8
14 changed files with 229 additions and 311 deletions

View File

@@ -30,15 +30,17 @@ func (app *CounterApplication) SetOption(req types.RequestSetOption) types.Respo
if key == "serial" && value == "on" {
app.serial = true
} else {
return types.ResponseSetOption{
Code: code.CodeTypeBadOption,
Log: cmn.Fmt("Unknown key (%s) or value (%s)", key, value),
}
/*
TODO Panic and have the ABCI server pass an exception.
The client can call SetOptionSync() and get an `error`.
return types.ResponseSetOption{
Error: cmn.Fmt("Unknown key (%s) or value (%s)", key, value),
}
*/
return types.ResponseSetOption{}
}
return types.ResponseSetOption{
Code: code.CodeTypeOK,
}
return types.ResponseSetOption{}
}
func (app *CounterApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
@@ -83,11 +85,11 @@ func (app *CounterApplication) CheckTx(tx []byte) types.ResponseCheckTx {
func (app *CounterApplication) Commit() (resp types.ResponseCommit) {
app.hashCount++
if app.txCount == 0 {
return types.ResponseCommit{Code: code.CodeTypeOK}
return types.ResponseCommit{}
}
hash := make([]byte, 8)
binary.BigEndian.PutUint64(hash, uint64(app.txCount))
return types.ResponseCommit{Code: code.CodeTypeOK, Data: hash}
return types.ResponseCommit{Data: hash}
}
func (app *CounterApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery {