Hotfix/validating query result length (#3053)

* Validating that there are txs in the query results before loop throught the array

* Created tests to validate the error has been fixed

* Added comments

* Fixing misspeling

* check if the variable "skipCount" is bigger than zero. If it is not, we set it to 0. If it, we do not do anything.

* using function that validates the skipCount variable

* undo Gopkg.lock changes
This commit is contained in:
Gian Felipe
2019-01-14 06:34:29 +11:00
committed by Ethan Buchman
parent a6011c007d
commit be00cd1add
4 changed files with 18 additions and 1 deletions

View File

@ -428,5 +428,10 @@ func TestTxSearch(t *testing.T) {
if len(result.Txs) == 0 {
t.Fatal("expected a lot of transactions")
}
// query a non existing tx with page 1 and txsPerPage 1
result, err = c.TxSearch("app.creator='Cosmoshi Neetowoko'", true, 1, 1)
require.Nil(t, err, "%+v", err)
require.Len(t, result.Txs, 0)
}
}