limit /tx_search output

Refs #909
This commit is contained in:
Anton Kaliaev
2018-05-14 16:01:49 +04:00
parent b5c4098c53
commit a6b74b82d1
9 changed files with 94 additions and 51 deletions

View File

@ -14,6 +14,12 @@ import (
"github.com/tendermint/tmlibs/log"
)
const (
// see README
defaultPerPage = 30
maxPerPage = 100
)
var subscribeTimeout = 5 * time.Second
//----------------------------------------------
@ -117,3 +123,17 @@ func SetLogger(l log.Logger) {
func SetEventBus(b *types.EventBus) {
eventBus = b
}
func validatePage(page int) int {
if page < 1 {
return 1
}
return page
}
func validatePerPage(perPage int) int {
if perPage < 1 || perPage > maxPerPage {
return defaultPerPage
}
return perPage
}