diff --git a/core/chains/evm/txmgr/finalizer.go b/core/chains/evm/txmgr/finalizer.go index 8d0de1116fa..74e23c7b77d 100644 --- a/core/chains/evm/txmgr/finalizer.go +++ b/core/chains/evm/txmgr/finalizer.go @@ -108,7 +108,6 @@ type evmFinalizer struct { resumeCallback resumeCallback attemptsCache []TxAttempt - attemptsCacheMu sync.Mutex attemptsCacheHitCount int } @@ -132,6 +131,7 @@ func NewEvmFinalizer( headTracker: headTracker, mb: mailbox.NewSingle[*types.Head](), resumeCallback: nil, + attemptsCacheHitCount: attemptsCacheRefreshThreshold, // start hit count at threshold to refresh cache on first run } } @@ -680,10 +680,8 @@ func (f *evmFinalizer) buildTxHashList(finalizedReceipts []*types.Receipt) []com // Attempts are cached and used for subsequent fetches to reduce the load of the query. // The attempts cache is refreshed every 3 requests. func (f *evmFinalizer) fetchAttemptsRequiringReceiptFetch(ctx context.Context) ([]TxAttempt, error) { - f.attemptsCacheMu.Lock() - defer f.attemptsCacheMu.Unlock() // Return attempts from attempts cache if it is populated and the hit count has not reached the threshold for refresh - if len(f.attemptsCache) != 0 && f.attemptsCacheHitCount < attemptsCacheRefreshThreshold { + if f.attemptsCacheHitCount < attemptsCacheRefreshThreshold { f.attemptsCacheHitCount++ return f.attemptsCache, nil } @@ -700,8 +698,6 @@ func (f *evmFinalizer) fetchAttemptsRequiringReceiptFetch(ctx context.Context) ( // filterAttemptsCache removes attempts from the cache if a receipt was found for their transaction's ID func (f *evmFinalizer) filterAttemptsCache(receipts []*types.Receipt) { - f.attemptsCacheMu.Lock() - defer f.attemptsCacheMu.Unlock() // Skip method if no receipts found if len(receipts) == 0 { return