Skip to content

Commit

Permalink
better division check
Browse files Browse the repository at this point in the history
  • Loading branch information
golangisfun123 committed Sep 30, 2024
1 parent 7fca370 commit 353b63c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion services/rfq/relayer/limiter/limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ func (l *limiterImpl) getNumberOfConfirmationsToWait(ctx context.Context, reques
}

Check warning on line 149 in services/rfq/relayer/limiter/limiter.go

View check run for this annotation

Codecov / codecov/patch

services/rfq/relayer/limiter/limiter.go#L148-L149

Added lines #L148 - L149 were not covered by tests

volumeLimitForChain := l.cfg.GetVolumeLimit(int(request.Transaction.OriginChainId), request.Transaction.OriginToken)
if volumeLimitForChain.Cmp(big.NewInt(-1)) == 0 {
return 0, nil
}

return uint64(new(big.Int).Div(
tokenVolume,
Expand All @@ -158,7 +161,7 @@ func (l *limiterImpl) getNumberOfConfirmationsToWait(ctx context.Context, reques

// isUnderVolumeLimit returns true if the request is under the volume limit, false otherwise.
func (l *limiterImpl) isUnderVolumeLimit(ctx context.Context, request *reldb.QuoteRequest) (_ bool, err error) {
ctx, span := l.metrics.Tracer().Start(ctx, "limiter.underVolumeLimitLimit")
ctx, span := l.metrics.Tracer().Start(ctx, "limiter.isUnderVolumeLimit")
defer func() {
metrics.EndSpanWithErr(span, err)
}()
Expand Down

0 comments on commit 353b63c

Please sign in to comment.