adapt Tendermint to new abci.Client interface

which was introduced in https://github.com/tendermint/abci/pull/130
This commit is contained in:
Anton Kaliaev
2017-11-22 18:55:09 -06:00
parent 4a31532897
commit f65e357d2b
16 changed files with 94 additions and 75 deletions

View File

@ -93,5 +93,5 @@ func ABCIInfo() (*ctypes.ResultABCIInfo, error) {
if err != nil {
return nil, err
}
return &ctypes.ResultABCIInfo{resInfo}, nil
return &ctypes.ResultABCIInfo{*resInfo}, nil
}

View File

@ -177,8 +177,8 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
if checkTxR.Code != abci.CodeType_OK {
// CheckTx failed!
return &ctypes.ResultBroadcastTxCommit{
CheckTx: checkTxR.Result(),
DeliverTx: abci.Result{},
CheckTx: *checkTxR,
DeliverTx: abci.ResponseDeliverTx{},
Hash: tx.Hash(),
}, nil
}
@ -191,23 +191,23 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) {
case deliverTxResMsg := <-deliverTxResCh:
deliverTxRes := deliverTxResMsg.(types.TMEventData).Unwrap().(types.EventDataTx)
// The tx was included in a block.
deliverTxR := &abci.ResponseDeliverTx{
deliverTxR := abci.ResponseDeliverTx{
Code: deliverTxRes.Result.Code,
Data: deliverTxRes.Result.Data,
Log: deliverTxRes.Result.Log,
}
logger.Info("DeliverTx passed ", "tx", data.Bytes(tx), "response", deliverTxR)
return &ctypes.ResultBroadcastTxCommit{
CheckTx: checkTxR.Result(),
DeliverTx: deliverTxR.Result(),
CheckTx: *checkTxR,
DeliverTx: deliverTxR,
Hash: tx.Hash(),
Height: deliverTxRes.Height,
}, nil
case <-timer.C:
logger.Error("failed to include tx")
return &ctypes.ResultBroadcastTxCommit{
CheckTx: checkTxR.Result(),
DeliverTx: abci.Result{},
CheckTx: *checkTxR,
DeliverTx: abci.ResponseDeliverTx{},
Hash: tx.Hash(),
}, fmt.Errorf("Timed out waiting for transaction to be included in a block")
}

View File

@ -94,7 +94,7 @@ func Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) {
return &ctypes.ResultTx{
Height: height,
Index: index,
TxResult: r.Result.Result(),
TxResult: r.Result,
Tx: r.Tx,
Proof: proof,
}, nil

View File

@ -104,18 +104,18 @@ type ResultBroadcastTx struct {
}
type ResultBroadcastTxCommit struct {
CheckTx abci.Result `json:"check_tx"`
DeliverTx abci.Result `json:"deliver_tx"`
Hash data.Bytes `json:"hash"`
Height uint64 `json:"height"`
CheckTx abci.ResponseCheckTx `json:"check_tx"`
DeliverTx abci.ResponseDeliverTx `json:"deliver_tx"`
Hash data.Bytes `json:"hash"`
Height uint64 `json:"height"`
}
type ResultTx struct {
Height uint64 `json:"height"`
Index uint32 `json:"index"`
TxResult abci.Result `json:"tx_result"`
Tx types.Tx `json:"tx"`
Proof types.TxProof `json:"proof,omitempty"`
Height uint64 `json:"height"`
Index uint32 `json:"index"`
TxResult abci.ResponseDeliverTx `json:"tx_result"`
Tx types.Tx `json:"tx"`
Proof types.TxProof `json:"proof,omitempty"`
}
type ResultUnconfirmedTxs struct {