Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R4R: Return an empty TxResponse #3624

Merged
merged 1 commit into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions types/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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()
Expand All @@ -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(),
Expand Down