balanceHistory: sanitize the groupBy parameter in websocket API

pull/345/head
Vladyslav Burzakovskyy 2020-01-07 14:30:21 +01:00 committed by Martin
parent 918e032bfe
commit 6919055e30
1 changed files with 3 additions and 0 deletions

View File

@ -280,6 +280,9 @@ var requestHandlers = map[string]func(*WebsocketServer, *websocketChannel, *webs
return
}
}
if r.GroupBy <= 0 {
r.GroupBy = 3600
}
rv, err = s.api.GetXpubBalanceHistory(r.Descriptor, fromTime, toTime, r.Fiat, r.Gap, r.GroupBy)
if err != nil {
rv, err = s.api.GetBalanceHistory(r.Descriptor, fromTime, toTime, r.Fiat, r.GroupBy)