From 5e5fb37774664036cb51079af5291a4aec48ace4 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Fri, 21 Apr 2017 18:39:02 +0300 Subject: [PATCH] rename TxID to Hash --- CHANGELOG.md | 2 +- rpc/client/rpc_test.go | 4 ++-- rpc/core/mempool.go | 10 +++++----- rpc/core/types/responses.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a722d454..7642668e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ IMPROVEMENTS: - CLI now uses Cobra framework - TMROOT is now TMHOME (TMROOT will stop working in 0.10.0) -- `/broadcast_tx_XXX` also returns the TxID (can be used to query for the tx) +- `/broadcast_tx_XXX` also returns the Hash (can be used to query for the tx) - `/broadcast_tx_commit` also returns the height the block was committed in - ABCIResponses struct persisted to disk before calling Commit; makes handshake replay much cleaner - WAL uses #ENDHEIGHT instead of #HEIGHT (#HEIGHT will stop working in 0.10.0) diff --git a/rpc/client/rpc_test.go b/rpc/client/rpc_test.go index 18f0f1aa..d9f5d379 100644 --- a/rpc/client/rpc_test.go +++ b/rpc/client/rpc_test.go @@ -133,8 +133,8 @@ func TestAppCalls(t *testing.T) { } // make sure we can lookup the tx with proof - // ptx, err := c.Tx(bres.TxID, true) - ptx, err := c.Tx(bres.TxID, true) + // ptx, err := c.Tx(bres.Hash, true) + ptx, err := c.Tx(bres.Hash, true) require.Nil(err, "%d: %+v", i, err) assert.Equal(txh, ptx.Height) assert.Equal(types.Tx(tx), ptx.Tx) diff --git a/rpc/core/mempool.go b/rpc/core/mempool.go index c4fc3b1a..4da83a1f 100644 --- a/rpc/core/mempool.go +++ b/rpc/core/mempool.go @@ -18,7 +18,7 @@ func BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) { if err != nil { return nil, fmt.Errorf("Error broadcasting transaction: %v", err) } - return &ctypes.ResultBroadcastTx{TxID: tx.Hash()}, nil + return &ctypes.ResultBroadcastTx{Hash: tx.Hash()}, nil } // Returns with the response from CheckTx @@ -36,7 +36,7 @@ func BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error) { Code: r.Code, Data: r.Data, Log: r.Log, - TxID: tx.Hash(), + Hash: tx.Hash(), }, nil } @@ -68,7 +68,7 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) { return &ctypes.ResultBroadcastTxCommit{ CheckTx: checkTxR, DeliverTx: nil, - TxID: tx.Hash(), + Hash: tx.Hash(), }, nil } @@ -88,7 +88,7 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) { return &ctypes.ResultBroadcastTxCommit{ CheckTx: checkTxR, DeliverTx: deliverTxR, - TxID: tx.Hash(), + Hash: tx.Hash(), Height: deliverTxRes.Height, }, nil case <-timer.C: @@ -96,7 +96,7 @@ func BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error) { return &ctypes.ResultBroadcastTxCommit{ CheckTx: checkTxR, DeliverTx: nil, - TxID: tx.Hash(), + Hash: tx.Hash(), }, fmt.Errorf("Timed out waiting for transaction to be included in a block") } diff --git a/rpc/core/types/responses.go b/rpc/core/types/responses.go index 940aa433..7cab8535 100644 --- a/rpc/core/types/responses.go +++ b/rpc/core/types/responses.go @@ -84,13 +84,13 @@ type ResultBroadcastTx struct { Data []byte `json:"data"` Log string `json:"log"` - TxID []byte `json:"tx_id"` + Hash []byte `json:"hash"` } type ResultBroadcastTxCommit struct { CheckTx *abci.ResponseCheckTx `json:"check_tx"` DeliverTx *abci.ResponseDeliverTx `json:"deliver_tx"` - TxID []byte `json:"tx_id"` + Hash []byte `json:"hash"` Height int `json:"height"` }