mirror of
https://github.com/tendermint/tendermint.git
synced 2026-08-31 21:27:04 +00:00
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:
@@ -6,6 +6,4 @@ const (
|
||||
CodeTypeEncodingError uint32 = 1
|
||||
CodeTypeBadNonce uint32 = 2
|
||||
CodeTypeUnauthorized uint32 = 3
|
||||
|
||||
CodeTypeBadOption uint32 = 101
|
||||
)
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -63,7 +63,7 @@ func (app *DummyApplication) Commit() types.ResponseCommit {
|
||||
}
|
||||
}
|
||||
|
||||
return types.ResponseCommit{Code: code.CodeTypeOK, Data: hash}
|
||||
return types.ResponseCommit{Data: hash}
|
||||
}
|
||||
|
||||
func (app *DummyApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {
|
||||
|
||||
@@ -97,7 +97,7 @@ func (app *PersistentDummyApplication) Commit() types.ResponseCommit {
|
||||
}
|
||||
|
||||
app.logger.Info("Commit block", "height", height, "root", appHash)
|
||||
return types.ResponseCommit{Code: code.CodeTypeOK, Data: appHash}
|
||||
return types.ResponseCommit{Data: appHash}
|
||||
}
|
||||
|
||||
func (app *PersistentDummyApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery {
|
||||
|
||||
Reference in New Issue
Block a user