@@ -111,7 +111,7 @@ type EVM struct {
111111 evmSigner types.Signer
112112 validationOptions * txpool.ValidationOptions
113113 collector metrics.Collector
114- limiter limiter.Store
114+ rateLimiter limiter.Store
115115}
116116
117117func NewEVM (
@@ -168,7 +168,7 @@ func NewEVM(
168168 MinTip : new (big.Int ),
169169 }
170170
171- ratelimiter , err := memorystore .New (
171+ rateLimiter , err := memorystore .New (
172172 & memorystore.Config {
173173 Tokens : config .TxRequestLimit ,
174174 Interval : config .TxRequestLimitDuration ,
@@ -190,7 +190,7 @@ func NewEVM(
190190 validationOptions : validationOptions ,
191191 collector : collector ,
192192 keystore : keystore ,
193- limiter : ratelimiter ,
193+ rateLimiter : rateLimiter ,
194194 }
195195
196196 return evm , nil
@@ -212,11 +212,12 @@ func (e *EVM) SendRawTransaction(ctx context.Context, data []byte) (common.Hash,
212212 }
213213
214214 if e .config .TxRequestLimit > 0 {
215- _ , _ , _ , ok , err := e .limiter .Take (ctx , from .Hex ())
215+ _ , _ , _ , ok , err := e .rateLimiter .Take (ctx , from .Hex ())
216216 if err != nil {
217217 return common.Hash {}, fmt .Errorf ("failed to check rate limit: %w" , err )
218218 }
219219 if ! ok {
220+ e .collector .RequestRateLimited ("SendRawTransaction" )
220221 return common.Hash {}, errs .ErrRateLimit
221222 }
222223 }
0 commit comments