mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-27 11:41:39 +00:00
CheckTx and DeliverTx return ResponseCheckTx and ResponseDeliverTx respectively
Commit now returns ResponseCommit
This commit is contained in:
@ -13,14 +13,14 @@ type Application interface {
|
||||
Query(RequestQuery) ResponseQuery // Query for state
|
||||
|
||||
// Mempool Connection
|
||||
CheckTx(tx []byte) Result // Validate a tx for the mempool
|
||||
CheckTx(tx []byte) ResponseCheckTx // Validate a tx for the mempool
|
||||
|
||||
// Consensus Connection
|
||||
InitChain(RequestInitChain) // Initialize blockchain with validators and other info from TendermintCore
|
||||
BeginBlock(RequestBeginBlock) // Signals the beginning of a block
|
||||
DeliverTx(tx []byte) Result // Deliver a tx for full processing
|
||||
DeliverTx(tx []byte) ResponseDeliverTx // Deliver a tx for full processing
|
||||
EndBlock(height uint64) ResponseEndBlock // Signals the end of a block, returns changes to the validator set
|
||||
Commit() Result // Commit the state and return the application Merkle root hash
|
||||
Commit() ResponseCommit // Commit the state and return the application Merkle root hash
|
||||
}
|
||||
|
||||
//------------------------------------
|
||||
|
@ -15,16 +15,16 @@ func (BaseApplication) SetOption(key string, value string) (log string) {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (BaseApplication) DeliverTx(tx []byte) Result {
|
||||
return NewResultOK(nil, "")
|
||||
func (BaseApplication) DeliverTx(tx []byte) ResponseDeliverTx {
|
||||
return ResponseDeliverTx{}
|
||||
}
|
||||
|
||||
func (BaseApplication) CheckTx(tx []byte) Result {
|
||||
return NewResultOK(nil, "")
|
||||
func (BaseApplication) CheckTx(tx []byte) ResponseCheckTx {
|
||||
return ResponseCheckTx{}
|
||||
}
|
||||
|
||||
func (BaseApplication) Commit() Result {
|
||||
return NewResultOK([]byte("nil"), "")
|
||||
func (BaseApplication) Commit() ResponseCommit {
|
||||
return ResponseCommit{Code: CodeType_OK, Data: []byte("nil")}
|
||||
}
|
||||
|
||||
func (BaseApplication) Query(req RequestQuery) ResponseQuery {
|
||||
|
@ -106,6 +106,10 @@ func (r *ResponseCheckTx) Result() Result {
|
||||
}
|
||||
}
|
||||
|
||||
func (r ResponseCheckTx) IsErr() bool {
|
||||
return r.Code != CodeType_OK
|
||||
}
|
||||
|
||||
// Convert ResponseDeliverTx to standard Result
|
||||
func (r *ResponseDeliverTx) Result() Result {
|
||||
return Result{
|
||||
@ -116,6 +120,10 @@ func (r *ResponseDeliverTx) Result() Result {
|
||||
}
|
||||
}
|
||||
|
||||
func (r ResponseDeliverTx) IsErr() bool {
|
||||
return r.Code != CodeType_OK
|
||||
}
|
||||
|
||||
type ResultQuery struct {
|
||||
Code CodeType `json:"code"`
|
||||
Index int64 `json:"index"`
|
||||
|
Reference in New Issue
Block a user