Merge PR #3264: Return an empty TxResponse when nil
This commit is contained in:
parent
2216f4716e
commit
22bdc1778b
|
@ -54,6 +54,8 @@ BUG FIXES
|
|||
|
||||
* Gaia
|
||||
* [\#3585] Fix setting the tx hash in `NewResponseFormatBroadcastTxCommit`.
|
||||
* [\#3585] Return an empty `TxResponse` when Tendermint returns an empty
|
||||
`ResultBroadcastTx`.
|
||||
|
||||
* SDK
|
||||
* [\#3582](https://github.com/cosmos/cosmos-sdk/pull/3582) Running `make test_unit was failing due to a missing tag
|
||||
|
|
|
@ -55,6 +55,10 @@ type TxResponse struct {
|
|||
}
|
||||
|
||||
func NewResponseResultTx(res *ctypes.ResultTx, tx Tx) TxResponse {
|
||||
if res == nil {
|
||||
return TxResponse{}
|
||||
}
|
||||
|
||||
return TxResponse{
|
||||
TxHash: res.Hash.String(),
|
||||
Height: res.Height,
|
||||
|
@ -70,6 +74,10 @@ func NewResponseResultTx(res *ctypes.ResultTx, tx Tx) TxResponse {
|
|||
}
|
||||
|
||||
func NewResponseFormatBroadcastTxCommit(res *ctypes.ResultBroadcastTxCommit) TxResponse {
|
||||
if res == nil {
|
||||
return TxResponse{}
|
||||
}
|
||||
|
||||
var txHash string
|
||||
if res.Hash != nil {
|
||||
txHash = res.Hash.String()
|
||||
|
@ -90,6 +98,10 @@ func NewResponseFormatBroadcastTxCommit(res *ctypes.ResultBroadcastTxCommit) TxR
|
|||
}
|
||||
|
||||
func NewResponseFormatBroadcastTx(res *ctypes.ResultBroadcastTx) TxResponse {
|
||||
if res == nil {
|
||||
return TxResponse{}
|
||||
}
|
||||
|
||||
return TxResponse{
|
||||
Code: res.Code,
|
||||
Data: res.Data.Bytes(),
|
||||
|
|
Loading…
Reference in New Issue