diff --git a/CHANGELOG.md b/CHANGELOG.md index 9efa8c047de5..81a22e048d87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ BREAKING CHANGES FEATURES * [gaiacli] You can now attach a simple text-only memo to any transaction, with the `--memo` flag +* [lcd] Queried TXs now include the tx hash to identify each tx * [mockapp] CompleteSetup() no longer takes a testing parameter FIXES diff --git a/client/lcd/lcd_test.go b/client/lcd/lcd_test.go index 8ad8b45dbea5..c3bec2f8b121 100644 --- a/client/lcd/lcd_test.go +++ b/client/lcd/lcd_test.go @@ -16,6 +16,7 @@ import ( cryptoKeys "github.com/tendermint/go-crypto/keys" p2p "github.com/tendermint/tendermint/p2p" ctypes "github.com/tendermint/tendermint/rpc/core/types" + "github.com/tendermint/tmlibs/common" client "github.com/cosmos/cosmos-sdk/client" keys "github.com/cosmos/cosmos-sdk/client/keys" @@ -309,6 +310,7 @@ func TestTxs(t *testing.T) { require.Equal(t, http.StatusOK, res.StatusCode, body) type txInfo struct { + Hash common.HexBytes `json:"hash"` Height int64 `json:"height"` Tx sdk.Tx `json:"tx"` Result abci.ResponseDeliverTx `json:"result"` @@ -324,6 +326,10 @@ func TestTxs(t *testing.T) { require.NoError(t, err) assert.Equal(t, 1, len(indexedTxs)) + // XXX should this move into some other testfile for txs in general? + // test if created TX hash is the correct hash + assert.Equal(t, resultTx.Hash, indexedTxs[0].Hash) + // query sender // also tests url decoding addrBech := sdk.MustBech32ifyAcc(addr) diff --git a/client/tx/query.go b/client/tx/query.go index 86439b3177a7..01cf959c8d35 100644 --- a/client/tx/query.go +++ b/client/tx/query.go @@ -7,6 +7,8 @@ import ( "net/http" "strconv" + "github.com/tendermint/tmlibs/common" + "github.com/gorilla/mux" "github.com/spf13/cobra" "github.com/spf13/viper" @@ -81,6 +83,7 @@ func formatTxResult(cdc *wire.Codec, res *ctypes.ResultTx) (txInfo, error) { } info := txInfo{ + Hash: res.Hash, Height: res.Height, Tx: tx, Result: res.TxResult, @@ -90,6 +93,7 @@ func formatTxResult(cdc *wire.Codec, res *ctypes.ResultTx) (txInfo, error) { // txInfo is used to prepare info to display type txInfo struct { + Hash common.HexBytes `json:"hash"` Height int64 `json:"height"` Tx sdk.Tx `json:"tx"` Result abci.ResponseDeliverTx `json:"result"`