Skip to content

Commit

Permalink
chore: Rate -> Limit
Browse files Browse the repository at this point in the history
  • Loading branch information
dudong2 committed Jan 17, 2025
1 parent 587d664 commit 734e644
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mempool/clist_mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func (mem *CListMempool) isFull(txSize int) error {
if mem.config.RateLimit > -1 {
if mem.rateLimitCounter.get() >= mem.config.RateLimit {
return ErrMempoolRateLimitExceeded{
Rate: mem.config.RateLimit,
Limit: mem.config.RateLimit,
Count: mem.rateLimitCounter.get(),
}
}
Expand Down
2 changes: 1 addition & 1 deletion mempool/clist_mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func TestRateLimit(t *testing.T) {
}
}
}
require.ErrorIs(t, err, ErrMempoolRateLimitExceeded{Rate: 3000, Count: 3000})
require.ErrorIs(t, err, ErrMempoolRateLimitExceeded{Limit: 3000, Count: 3000})
}

func TestTxsAvailable(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions mempool/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ func (e ErrMempoolIsFull) Error() string {
}

type ErrMempoolRateLimitExceeded struct {
Rate int32
Limit int32
Count int32
}

func (e ErrMempoolRateLimitExceeded) Error() string {
return fmt.Sprintf("mempool rate limit exceeded: rate %d, count %d", e.Rate, e.Count)
return fmt.Sprintf("mempool rate limit exceeded: limit %d, count %d", e.Limit, e.Count)
}

// ErrPreCheck defines an error where a transaction fails a pre-check.
Expand Down

0 comments on commit 734e644

Please sign in to comment.