Skip to content

Commit

Permalink
more code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
freemanzMrojo committed Feb 6, 2025
1 parent b85dbc2 commit 457a20e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/fees/fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package fees

import (
"math"
"net/http"
"strconv"

Expand Down Expand Up @@ -46,7 +47,7 @@ func (f *Fees) validateGetFeesHistoryParams(req *http.Request) (uint32, *chain.B
return 0, nil, err
}
// Too old
minAllowedBlock := f.data.repo.BestBlockSummary().Header.Number() - f.data.backtraceLimit + 1
minAllowedBlock := uint32(math.Max(0, float64(int(f.data.repo.BestBlockSummary().Header.Number())-int(f.data.backtraceLimit)+1)))
if newestBlockSummary.Header.Number() < minAllowedBlock {
// If the starting block is below the allowed range, return-fast.
return 0, nil, utils.BadRequest(errors.New("newestBlock not in the allowed range"))
Expand Down

0 comments on commit 457a20e

Please sign in to comment.