File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -124,6 +124,9 @@ func (t *BatchTxPool) Add(
124124 return err
125125 }
126126
127+ t .txMux .Lock ()
128+ defer t .txMux .Unlock ()
129+
127130 eoaActivity , found := t .eoaActivityCache .Get (from )
128131 nonce := tx .Nonce ()
129132
@@ -162,13 +165,11 @@ func (t *BatchTxPool) Add(
162165 // If the EOA has pooled transactions, which are not yet processed,
163166 // due to congestion or anything, make sure to include the current
164167 // tx on that batch.
165- t .txMux .Lock ()
166168 hasBatch := len (t .pooledTxs [from ]) > 0
167169 if hasBatch {
168170 userTx := pooledEvmTx {txPayload : hexEncodedTx , nonce : nonce }
169171 t .pooledTxs [from ] = append (t .pooledTxs [from ], userTx )
170172 }
171- t .txMux .Unlock ()
172173
173174 // If it wasn't batched, submit individually
174175 if ! hasBatch {
@@ -177,10 +178,8 @@ func (t *BatchTxPool) Add(
177178 }
178179 } else {
179180 // Case 3. EOA activity found AND it was less than [X] seconds ago:
180- t .txMux .Lock ()
181181 userTx := pooledEvmTx {txPayload : hexEncodedTx , nonce : nonce }
182182 t .pooledTxs [from ] = append (t .pooledTxs [from ], userTx )
183- t .txMux .Unlock ()
184183 }
185184
186185 if err != nil {
@@ -319,9 +318,6 @@ func (t *BatchTxPool) updateEOAActivityMetadata(
319318 from gethCommon.Address ,
320319 nonce uint64 ,
321320) {
322- t .txMux .Lock ()
323- defer t .txMux .Unlock ()
324-
325321 // Update metadata for the last EOA activity only on successful add/submit.
326322 eoaActivity , _ := t .eoaActivityCache .Get (from )
327323 eoaActivity .lastSubmission = time .Now ()
You can’t perform that action at this time.
0 commit comments