balanceHistory: sanitize the groupBy parameter in websocket API

This commit is contained in:
Vladyslav Burzakovskyy 2020-01-07 14:30:21 +01:00 committed by Martin
parent 918e032bfe
commit 6919055e30

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)