mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-13 21:31:23 +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
|
return nil, err
|
||||||
}
|
}
|
||||||
log.Info("ABCIQuery", "path", path, "data", data, "result", resQuery)
|
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) {
|
func ABCIInfo() (*ctypes.ResultABCIInfo, error) {
|
||||||
|
@ -67,8 +67,8 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
|||||||
if checkTxR.Code != abci.CodeType_OK {
|
if checkTxR.Code != abci.CodeType_OK {
|
||||||
// CheckTx failed!
|
// CheckTx failed!
|
||||||
return &ctypes.ResultBroadcastTxCommit{
|
return &ctypes.ResultBroadcastTxCommit{
|
||||||
CheckTx: checkTxR,
|
CheckTx: checkTxR.Result(),
|
||||||
DeliverTx: nil,
|
DeliverTx: abci.Result{},
|
||||||
Hash: tx.Hash(),
|
Hash: tx.Hash(),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
@ -87,16 +87,16 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
|
|||||||
}
|
}
|
||||||
log.Notice("DeliverTx passed ", "tx", data.Bytes(tx), "response", deliverTxR)
|
log.Notice("DeliverTx passed ", "tx", data.Bytes(tx), "response", deliverTxR)
|
||||||
return &ctypes.ResultBroadcastTxCommit{
|
return &ctypes.ResultBroadcastTxCommit{
|
||||||
CheckTx: checkTxR,
|
CheckTx: checkTxR.Result(),
|
||||||
DeliverTx: deliverTxR,
|
DeliverTx: deliverTxR.Result(),
|
||||||
Hash: tx.Hash(),
|
Hash: tx.Hash(),
|
||||||
Height: deliverTxRes.Height,
|
Height: deliverTxRes.Height,
|
||||||
}, nil
|
}, nil
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
log.Error("failed to include tx")
|
log.Error("failed to include tx")
|
||||||
return &ctypes.ResultBroadcastTxCommit{
|
return &ctypes.ResultBroadcastTxCommit{
|
||||||
CheckTx: checkTxR,
|
CheckTx: checkTxR.Result(),
|
||||||
DeliverTx: nil,
|
DeliverTx: abci.Result{},
|
||||||
Hash: tx.Hash(),
|
Hash: tx.Hash(),
|
||||||
}, fmt.Errorf("Timed out waiting for transaction to be included in a block")
|
}, 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{
|
return &ctypes.ResultTx{
|
||||||
Height: height,
|
Height: height,
|
||||||
Index: index,
|
Index: index,
|
||||||
TxResult: r.Result,
|
TxResult: r.Result.Result(),
|
||||||
Tx: r.Tx,
|
Tx: r.Tx,
|
||||||
Proof: proof,
|
Proof: proof,
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -89,18 +89,18 @@ type ResultBroadcastTx struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ResultBroadcastTxCommit struct {
|
type ResultBroadcastTxCommit struct {
|
||||||
CheckTx *abci.ResponseCheckTx `json:"check_tx"`
|
CheckTx abci.Result `json:"check_tx"`
|
||||||
DeliverTx *abci.ResponseDeliverTx `json:"deliver_tx"`
|
DeliverTx abci.Result `json:"deliver_tx"`
|
||||||
Hash data.Bytes `json:"hash"`
|
Hash data.Bytes `json:"hash"`
|
||||||
Height int `json:"height"`
|
Height int `json:"height"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResultTx struct {
|
type ResultTx struct {
|
||||||
Height int `json:"height"`
|
Height int `json:"height"`
|
||||||
Index int `json:"index"`
|
Index int `json:"index"`
|
||||||
TxResult abci.ResponseDeliverTx `json:"tx_result"`
|
TxResult abci.Result `json:"tx_result"`
|
||||||
Tx types.Tx `json:"tx"`
|
Tx types.Tx `json:"tx"`
|
||||||
Proof types.TxProof `json:"proof,omitempty"`
|
Proof types.TxProof `json:"proof,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResultUnconfirmedTxs struct {
|
type ResultUnconfirmedTxs struct {
|
||||||
@ -113,7 +113,13 @@ type ResultABCIInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ResultABCIQuery 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{}
|
type ResultUnsafeFlushMempool struct{}
|
||||||
|
@ -3,6 +3,8 @@ package core_grpc
|
|||||||
import (
|
import (
|
||||||
core "github.com/tendermint/tendermint/rpc/core"
|
core "github.com/tendermint/tendermint/rpc/core"
|
||||||
|
|
||||||
|
abci "github.com/tendermint/abci/types"
|
||||||
|
|
||||||
context "golang.org/x/net/context"
|
context "golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,5 +16,17 @@ func (bapi *broadcastAPI) BroadcastTx(ctx context.Context, req *RequestBroadcast
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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