mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-13 11:34:17 +00:00
CommitSync returns tmsp.Result
This commit is contained in:
@@ -16,7 +16,7 @@ type Application interface {
|
||||
CheckTx(tx []byte) Result
|
||||
|
||||
// Return the application Merkle root hash
|
||||
Commit() (hash []byte, log string)
|
||||
Commit() Result
|
||||
|
||||
// Query for state
|
||||
Query(query []byte) Result
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package types
|
||||
|
||||
var (
|
||||
OK = NewResultOK(nil, "")
|
||||
|
||||
ErrInternalError = NewError(CodeType_InternalError, "Internal error")
|
||||
ErrEncodingError = NewError(CodeType_EncodingError, "Encoding error")
|
||||
ErrBadNonce = NewError(CodeType_BadNonce, "Error bad nonce")
|
||||
ErrUnauthorized = NewError(CodeType_Unauthorized, "Unauthorized")
|
||||
ErrInsufficientFunds = NewError(CodeType_InsufficientFunds, "Insufficient funds")
|
||||
ErrUnknownRequest = NewError(CodeType_UnknownRequest, "Unknown request")
|
||||
|
||||
ErrBaseDuplicateAddress = NewError(CodeType_BaseDuplicateAddress, "Error duplicate address")
|
||||
ErrBaseEncodingError = NewError(CodeType_BaseEncodingError, "Error encoding error")
|
||||
ErrBaseInsufficientFees = NewError(CodeType_BaseInsufficientFees, "Error insufficient fees")
|
||||
ErrBaseInsufficientFunds = NewError(CodeType_BaseInsufficientFunds, "Error insufficient funds")
|
||||
ErrBaseInsufficientGasPrice = NewError(CodeType_BaseInsufficientGasPrice, "Error insufficient gas price")
|
||||
ErrBaseInvalidAddress = NewError(CodeType_BaseInvalidAddress, "Error invalid address")
|
||||
ErrBaseInvalidAmount = NewError(CodeType_BaseInvalidAmount, "Error invalid amount")
|
||||
ErrBaseInvalidPubKey = NewError(CodeType_BaseInvalidPubKey, "Error invalid pubkey")
|
||||
ErrBaseInvalidSequence = NewError(CodeType_BaseInvalidSequence, "Error invalid sequence")
|
||||
ErrBaseInvalidSignature = NewError(CodeType_BaseInvalidSignature, "Error invalid signature")
|
||||
ErrBaseUnknownPubKey = NewError(CodeType_BaseUnknownPubKey, "Error unknown pubkey")
|
||||
)
|
||||
+9
-8
@@ -111,37 +111,38 @@ func ResponseSetOption(log string) *Response {
|
||||
}
|
||||
}
|
||||
|
||||
func ResponseAppendTx(code CodeType, result []byte, log string) *Response {
|
||||
func ResponseAppendTx(code CodeType, data []byte, log string) *Response {
|
||||
return &Response{
|
||||
Type: MessageType_AppendTx,
|
||||
Code: code,
|
||||
Data: result,
|
||||
Data: data,
|
||||
Log: log,
|
||||
}
|
||||
}
|
||||
|
||||
func ResponseCheckTx(code CodeType, result []byte, log string) *Response {
|
||||
func ResponseCheckTx(code CodeType, data []byte, log string) *Response {
|
||||
return &Response{
|
||||
Type: MessageType_CheckTx,
|
||||
Code: code,
|
||||
Data: result,
|
||||
Data: data,
|
||||
Log: log,
|
||||
}
|
||||
}
|
||||
|
||||
func ResponseCommit(hash []byte, log string) *Response {
|
||||
func ResponseCommit(code CodeType, data []byte, log string) *Response {
|
||||
return &Response{
|
||||
Type: MessageType_Commit,
|
||||
Data: hash,
|
||||
Code: code,
|
||||
Data: data,
|
||||
Log: log,
|
||||
}
|
||||
}
|
||||
|
||||
func ResponseQuery(code CodeType, result []byte, log string) *Response {
|
||||
func ResponseQuery(code CodeType, data []byte, log string) *Response {
|
||||
return &Response{
|
||||
Type: MessageType_Query,
|
||||
Code: code,
|
||||
Data: result,
|
||||
Data: data,
|
||||
Log: log,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,10 @@ func (res Result) IsOK() bool {
|
||||
return res.Code == CodeType_OK
|
||||
}
|
||||
|
||||
func (res Result) IsErr() bool {
|
||||
return res.Code != CodeType_OK
|
||||
}
|
||||
|
||||
func (res Result) Error() string {
|
||||
return fmt.Sprintf("TMSP error code:%v, data:%X, log:%v", res.Code, res.Data, res.Log)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user