mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-27 11:41:39 +00:00
remove CodeType
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/tendermint/abci/example/code"
|
||||
"github.com/tendermint/abci/types"
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
"github.com/tendermint/iavl"
|
||||
@ -96,7 +97,7 @@ func (app *PersistentDummyApplication) Commit() types.ResponseCommit {
|
||||
}
|
||||
|
||||
app.logger.Info("Commit block", "height", height, "root", appHash)
|
||||
return types.ResponseCommit{Code: types.CodeType_OK, Data: appHash}
|
||||
return types.ResponseCommit{Code: types.CodeTypeOK, Data: appHash}
|
||||
}
|
||||
|
||||
func (app *PersistentDummyApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery {
|
||||
@ -160,7 +161,7 @@ func (app *PersistentDummyApplication) execValidatorTx(tx []byte) types.Response
|
||||
pubKeyAndPower := strings.Split(string(tx), "/")
|
||||
if len(pubKeyAndPower) != 2 {
|
||||
return types.ResponseDeliverTx{
|
||||
Code: types.CodeType_EncodingError,
|
||||
Code: code.CodeTypeEncodingError,
|
||||
Log: fmt.Sprintf("Expected 'pubkey/power'. Got %v", pubKeyAndPower)}
|
||||
}
|
||||
pubkeyS, powerS := pubKeyAndPower[0], pubKeyAndPower[1]
|
||||
@ -169,13 +170,13 @@ func (app *PersistentDummyApplication) execValidatorTx(tx []byte) types.Response
|
||||
pubkey, err := hex.DecodeString(pubkeyS)
|
||||
if err != nil {
|
||||
return types.ResponseDeliverTx{
|
||||
Code: types.CodeType_EncodingError,
|
||||
Code: code.CodeTypeEncodingError,
|
||||
Log: fmt.Sprintf("Pubkey (%s) is invalid hex", pubkeyS)}
|
||||
}
|
||||
_, err = crypto.PubKeyFromBytes(pubkey)
|
||||
if err != nil {
|
||||
return types.ResponseDeliverTx{
|
||||
Code: types.CodeType_EncodingError,
|
||||
Code: code.CodeTypeEncodingError,
|
||||
Log: fmt.Sprintf("Pubkey (%X) is invalid go-crypto encoded", pubkey)}
|
||||
}
|
||||
|
||||
@ -183,7 +184,7 @@ func (app *PersistentDummyApplication) execValidatorTx(tx []byte) types.Response
|
||||
power, err := strconv.Atoi(powerS)
|
||||
if err != nil {
|
||||
return types.ResponseDeliverTx{
|
||||
Code: types.CodeType_EncodingError,
|
||||
Code: code.CodeTypeEncodingError,
|
||||
Log: fmt.Sprintf("Power (%s) is not an int", powerS)}
|
||||
}
|
||||
|
||||
@ -198,7 +199,7 @@ func (app *PersistentDummyApplication) updateValidator(v *types.Validator) types
|
||||
// remove validator
|
||||
if !app.app.state.Has(key) {
|
||||
return types.ResponseDeliverTx{
|
||||
Code: types.CodeType_Unauthorized,
|
||||
Code: code.CodeTypeUnauthorized,
|
||||
Log: fmt.Sprintf("Cannot remove non-existent validator %X", key)}
|
||||
}
|
||||
app.app.state.Remove(key)
|
||||
@ -207,7 +208,7 @@ func (app *PersistentDummyApplication) updateValidator(v *types.Validator) types
|
||||
value := bytes.NewBuffer(make([]byte, 0))
|
||||
if err := types.WriteMessage(v, value); err != nil {
|
||||
return types.ResponseDeliverTx{
|
||||
Code: types.CodeType_InternalError,
|
||||
Code: code.CodeTypeEncodingError,
|
||||
Log: fmt.Sprintf("Error encoding validator: %v", err)}
|
||||
}
|
||||
app.app.state.Set(key, value.Bytes())
|
||||
@ -216,5 +217,5 @@ func (app *PersistentDummyApplication) updateValidator(v *types.Validator) types
|
||||
// we only update the changes array if we successfully updated the tree
|
||||
app.changes = append(app.changes, v)
|
||||
|
||||
return types.ResponseDeliverTx{Code: types.CodeType_OK}
|
||||
return types.ResponseDeliverTx{Code: types.CodeTypeOK}
|
||||
}
|
||||
|
Reference in New Issue
Block a user