TxResult includes Tx. /tx only works if indexer active

This commit is contained in:
Ethan Buchman
2017-04-18 19:56:41 -04:00
parent d572bb0c5d
commit f4d0076344
12 changed files with 68 additions and 117 deletions
+3 -5
View File
@@ -160,13 +160,11 @@ func (c *HTTP) Commit(height int) (*ctypes.ResultCommit, error) {
return (*tmResult).(*ctypes.ResultCommit), nil
}
func (c *HTTP) Tx(hash []byte, height, index int, prove bool) (*ctypes.ResultTx, error) {
func (c *HTTP) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) {
tmResult := new(ctypes.TMResult)
query := map[string]interface{}{
"height": height,
"index": index,
"hash": hash,
"prove": prove,
"hash": hash,
"prove": prove,
}
_, err := c.rpc.Call("tx", query, tmResult)
if err != nil {
+1 -1
View File
@@ -44,7 +44,7 @@ type SignClient interface {
Block(height int) (*ctypes.ResultBlock, error)
Commit(height int) (*ctypes.ResultCommit, error)
Validators() (*ctypes.ResultValidators, error)
Tx(hash []byte, height, index int, prove bool) (*ctypes.ResultTx, error)
Tx(hash []byte, prove bool) (*ctypes.ResultTx, error)
}
// HistoryClient shows us data from genesis to now in large chunks.
+2 -2
View File
@@ -104,6 +104,6 @@ func (c Local) Validators() (*ctypes.ResultValidators, error) {
return core.Validators()
}
func (c Local) Tx(hash []byte, height, index int, prove bool) (*ctypes.ResultTx, error) {
return core.Tx(hash, height, index, prove)
func (c Local) Tx(hash []byte, prove bool) (*ctypes.ResultTx, error) {
return core.Tx(hash, prove)
}
+2 -2
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, txh, 0, true)
ptx, err := c.Tx(bres.TxID, 0, 0, true)
// ptx, err := c.Tx(bres.TxID, true)
ptx, err := c.Tx(bres.TxID, true)
require.Nil(err, "%d: %+v", i, err)
assert.Equal(txh, ptx.Height)
assert.Equal(types.Tx(tx), ptx.Tx)