Browse Source

rename TxID to Hash

pull/453/head
Anton Kaliaev 7 years ago
parent
commit
5e5fb37774
No known key found for this signature in database GPG Key ID: 7B6881D965918214
4 changed files with 10 additions and 10 deletions
  1. +1
    -1
      CHANGELOG.md
  2. +2
    -2
      rpc/client/rpc_test.go
  3. +5
    -5
      rpc/core/mempool.go
  4. +2
    -2
      rpc/core/types/responses.go

+ 1
- 1
CHANGELOG.md View File

@ -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)


+ 2
- 2
rpc/client/rpc_test.go View File

@ -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)


+ 5
- 5
rpc/core/mempool.go View File

@ -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")
}


+ 2
- 2
rpc/core/types/responses.go View File

@ -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"`
}


Loading…
Cancel
Save