diff --git a/rpc/core/abci.go b/rpc/core/abci.go index 5c9fcfc2..4b210ff1 100644 --- a/rpc/core/abci.go +++ b/rpc/core/abci.go @@ -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) { diff --git a/rpc/core/mempool.go b/rpc/core/mempool.go index 4adf75ce..4c1b54cf 100644 --- a/rpc/core/mempool.go +++ b/rpc/core/mempool.go @@ -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") } diff --git a/rpc/core/tx.go b/rpc/core/tx.go index 7f3cdd03..387d4afa 100644 --- a/rpc/core/tx.go +++ b/rpc/core/tx.go @@ -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 diff --git a/rpc/core/types/responses.go b/rpc/core/types/responses.go index b4b52c9e..367c82d2 100644 --- a/rpc/core/types/responses.go +++ b/rpc/core/types/responses.go @@ -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{} diff --git a/rpc/grpc/api.go b/rpc/grpc/api.go index fab811c2..7cfda158 100644 --- a/rpc/grpc/api.go +++ b/rpc/grpc/api.go @@ -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 }