diff --git a/apiserver/controllers/block.go b/apiserver/controllers/block.go index 04030ab3b..218b10ff2 100644 --- a/apiserver/controllers/block.go +++ b/apiserver/controllers/block.go @@ -54,9 +54,9 @@ func GetBlockByHashHandler(blockHash string) (interface{}, error) { // GetBlocksHandler searches for all blocks func GetBlocksHandler(order string, skip uint64, limit uint64) (interface{}, error) { - if limit > maxGetBlocksLimit { + if limit < 1 || limit > maxGetBlocksLimit { return nil, httpserverutils.NewHandlerError(http.StatusBadRequest, - errors.Errorf("Limit higher than %d or lower than 0 was requested.", maxGetBlocksLimit)) + errors.Errorf("Limit higher than %d or lower than 1 was requested.", maxGetTransactionsLimit)) } blocks := []*dbmodels.Block{} db, err := database.DB() diff --git a/apiserver/controllers/transaction.go b/apiserver/controllers/transaction.go index e7ba16d54..7e70f8cce 100644 --- a/apiserver/controllers/transaction.go +++ b/apiserver/controllers/transaction.go @@ -79,9 +79,9 @@ func GetTransactionByHashHandler(txHash string) (interface{}, error) { // GetTransactionsByAddressHandler searches for all transactions // where the given address is either an input or an output. func GetTransactionsByAddressHandler(address string, skip uint64, limit uint64) (interface{}, error) { - if limit > maxGetTransactionsLimit { + if limit < 1 || limit > maxGetTransactionsLimit { return nil, httpserverutils.NewHandlerError(http.StatusBadRequest, - errors.Errorf("Limit higher than %d or lower than 0 was requested.", maxGetTransactionsLimit)) + errors.Errorf("Limit higher than %d or lower than 1 was requested.", maxGetTransactionsLimit)) } db, err := database.DB()