Merge pull request #264 from meshplus/fix/fix-tps-param-type

fix(API): fix block number overflow issue
This commit is contained in:
Aiden X 2020-11-25 19:10:50 +08:00 committed by GitHub
commit cf4bc32759
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -34,7 +34,11 @@ func (api *ChainAPI) TPS(begin, end uint64) (uint64, error) {
wg sync.WaitGroup
)
if begin >= end {
if int(begin) <= 0 {
return 0, fmt.Errorf("begin number should be greater than zero")
}
if int(begin) >= int(end) {
return 0, fmt.Errorf("begin number should be smaller than end number")
}