Browse Source

test searching txs by height

Refs #2051
pull/2333/head
Anton Kaliaev 6 years ago
parent
commit
098681fd91
No known key found for this signature in database GPG Key ID: 7B6881D965918214
2 changed files with 6 additions and 1 deletions
  1. +5
    -0
      rpc/client/rpc_test.go
  2. +1
    -1
      rpc/test/helpers.go

+ 5
- 0
rpc/client/rpc_test.go View File

@ -351,6 +351,11 @@ func TestTxSearch(t *testing.T) {
assert.True(t, proof.Proof.Verify(proof.Index, proof.Total, txHash, proof.RootHash))
}
// query by height
result, err = c.TxSearch(fmt.Sprintf("tx.height >= %d", txHeight), true, 1, 30)
require.Nil(t, err, "%+v", err)
require.Len(t, result.Txs, 1)
// we query for non existing tx
result, err = c.TxSearch(fmt.Sprintf("tx.hash='%X'", anotherTxHash), false, 1, 30)
require.Nil(t, err, "%+v", err)


+ 1
- 1
rpc/test/helpers.go View File

@ -85,7 +85,7 @@ func GetConfig() *cfg.Config {
globalConfig.P2P.ListenAddress = tm
globalConfig.RPC.ListenAddress = rpc
globalConfig.RPC.GRPCListenAddress = grpc
globalConfig.TxIndex.IndexTags = "app.creator" // see kvstore application
globalConfig.TxIndex.IndexTags = "app.creator,tx.height" // see kvstore application
}
return globalConfig
}


Loading…
Cancel
Save