mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 22:01:20 +00:00
rpc: response types use Result instead of pb Response
This commit is contained in:
@ -18,7 +18,15 @@ func ABCIQuery(path string, data data.Bytes, prove bool) (*ctypes.ResultABCIQuer
|
||||
return nil, err
|
||||
}
|
||||
log.Info("ABCIQuery", "path", path, "data", data, "result", resQuery)
|
||||
return &ctypes.ResultABCIQuery{resQuery}, nil
|
||||
return &ctypes.ResultABCIQuery{
|
||||
Code: resQuery.Code,
|
||||
Index: resQuery.Index,
|
||||
Key: resQuery.Key,
|
||||
Value: resQuery.Value,
|
||||
Proof: resQuery.Proof,
|
||||
Height: resQuery.Height,
|
||||
Log: resQuery.Log,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
||||
|
@ -67,8 +67,8 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
||||
if checkTxR.Code != abci.CodeType_OK {
|
||||
// CheckTx failed!
|
||||
return &ctypes.ResultBroadcastTxCommit{
|
||||
CheckTx: checkTxR,
|
||||
DeliverTx: nil,
|
||||
CheckTx: checkTxR.Result(),
|
||||
DeliverTx: abci.Result{},
|
||||
Hash: tx.Hash(),
|
||||
}, nil
|
||||
}
|
||||
@ -87,16 +87,16 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
||||
}
|
||||
log.Notice("DeliverTx passed ", "tx", data.Bytes(tx), "response", deliverTxR)
|
||||
return &ctypes.ResultBroadcastTxCommit{
|
||||
CheckTx: checkTxR,
|
||||
DeliverTx: deliverTxR,
|
||||
CheckTx: checkTxR.Result(),
|
||||
DeliverTx: deliverTxR.Result(),
|
||||
Hash: tx.Hash(),
|
||||
Height: deliverTxRes.Height,
|
||||
}, nil
|
||||
case <-timer.C:
|
||||
log.Error("failed to include tx")
|
||||
return &ctypes.ResultBroadcastTxCommit{
|
||||
CheckTx: checkTxR,
|
||||
DeliverTx: nil,
|
||||
CheckTx: checkTxR.Result(),
|
||||
DeliverTx: abci.Result{},
|
||||
Hash: tx.Hash(),
|
||||
}, fmt.Errorf("Timed out waiting for transaction to be included in a block")
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ func Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) {
|
||||
return &ctypes.ResultTx{
|
||||
Height: height,
|
||||
Index: index,
|
||||
TxResult: r.Result,
|
||||
TxResult: r.Result.Result(),
|
||||
Tx: r.Tx,
|
||||
Proof: proof,
|
||||
}, nil
|
||||
|
@ -89,18 +89,18 @@ type ResultBroadcastTx struct {
|
||||
}
|
||||
|
||||
type ResultBroadcastTxCommit struct {
|
||||
CheckTx *abci.ResponseCheckTx `json:"check_tx"`
|
||||
DeliverTx *abci.ResponseDeliverTx `json:"deliver_tx"`
|
||||
Hash data.Bytes `json:"hash"`
|
||||
Height int `json:"height"`
|
||||
CheckTx abci.Result `json:"check_tx"`
|
||||
DeliverTx abci.Result `json:"deliver_tx"`
|
||||
Hash data.Bytes `json:"hash"`
|
||||
Height int `json:"height"`
|
||||
}
|
||||
|
||||
type ResultTx struct {
|
||||
Height int `json:"height"`
|
||||
Index int `json:"index"`
|
||||
TxResult abci.ResponseDeliverTx `json:"tx_result"`
|
||||
Tx types.Tx `json:"tx"`
|
||||
Proof types.TxProof `json:"proof,omitempty"`
|
||||
Height int `json:"height"`
|
||||
Index int `json:"index"`
|
||||
TxResult abci.Result `json:"tx_result"`
|
||||
Tx types.Tx `json:"tx"`
|
||||
Proof types.TxProof `json:"proof,omitempty"`
|
||||
}
|
||||
|
||||
type ResultUnconfirmedTxs struct {
|
||||
@ -113,7 +113,13 @@ type ResultABCIInfo struct {
|
||||
}
|
||||
|
||||
type ResultABCIQuery struct {
|
||||
Response abci.ResponseQuery `json:"response"`
|
||||
Code abci.CodeType `json:"code"`
|
||||
Index int64 `json:"index"`
|
||||
Key []byte `json:"key"`
|
||||
Value []byte `json:"value"`
|
||||
Proof []byte `json:"proof"`
|
||||
Height uint64 `json:"height"`
|
||||
Log string `json:"log"`
|
||||
}
|
||||
|
||||
type ResultUnsafeFlushMempool struct{}
|
||||
|
@ -3,6 +3,8 @@ package core_grpc
|
||||
import (
|
||||
core "github.com/tendermint/tendermint/rpc/core"
|
||||
|
||||
abci "github.com/tendermint/abci/types"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
)
|
||||
|
||||
@ -14,5 +16,17 @@ func (bapi *broadcastAPI) BroadcastTx(ctx context.Context, req *RequestBroadcast
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ResponseBroadcastTx{res.CheckTx, res.DeliverTx}, nil
|
||||
return &ResponseBroadcastTx{
|
||||
|
||||
CheckTx: &abci.ResponseCheckTx{
|
||||
Code: res.CheckTx.Code,
|
||||
Data: res.CheckTx.Data,
|
||||
Log: res.CheckTx.Log,
|
||||
},
|
||||
DeliverTx: &abci.ResponseDeliverTx{
|
||||
Code: res.DeliverTx.Code,
|
||||
Data: res.DeliverTx.Data,
|
||||
Log: res.DeliverTx.Log,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user