Skip to content

Commit

Permalink
add precondition
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanBratanov committed Jan 10, 2025
1 parent 9cd98a4 commit 16ad3d0
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

package tech.pegasys.teku.networking.eth2.peers;

import com.google.common.base.Preconditions;
import java.util.NavigableMap;
import java.util.Optional;
import java.util.TreeMap;
Expand All @@ -32,6 +33,10 @@ public class RateTrackerImpl implements RateTracker {

public RateTrackerImpl(
final int peerRateLimit, final long timeoutSeconds, final TimeProvider timeProvider) {
Preconditions.checkArgument(
peerRateLimit > 0,
"peerRateLimit should be a positive number but it was %s",
peerRateLimit);
this.peerRateLimit = peerRateLimit;
this.timeoutSeconds = timeoutSeconds;
this.timeProvider = timeProvider;
Expand Down

0 comments on commit 16ad3d0

Please sign in to comment.