This repository was archived by the owner on Oct 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1
1
package mempool
2
2
3
3
import (
4
+ "sync"
4
5
"sync/atomic"
5
6
6
7
"github.com/ethereum/go-ethereum/common"
@@ -27,19 +28,21 @@ func (s *set) getSenderSortedSet(sender common.Address) *sortedset.SortedSet {
27
28
type userOpQueues struct {
28
29
maxBatchSize int
29
30
opCount uint64
30
- setsByEntryPoint map [common. Address ] * set
31
+ setsByEntryPoint sync. Map
31
32
}
32
33
33
34
func (q * userOpQueues ) getEntryPointSet (entryPoint common.Address ) * set {
34
- if _ , ok := q .setsByEntryPoint [entryPoint ]; ! ok {
35
- q .setsByEntryPoint [entryPoint ] = & set {
35
+ val , ok := q .setsByEntryPoint .Load (entryPoint )
36
+ if ! ok {
37
+ val = & set {
36
38
all : sortedset .New (),
37
39
arrival : sortedset .New (),
38
40
senders : make (map [common.Address ]* sortedset.SortedSet ),
39
41
}
42
+ q .setsByEntryPoint .Store (entryPoint , val )
40
43
}
41
44
42
- return q . setsByEntryPoint [ entryPoint ]
45
+ return val .( * set )
43
46
}
44
47
45
48
func (q * userOpQueues ) AddOp (entryPoint common.Address , op * userop.UserOperation ) {
@@ -110,7 +113,6 @@ func (q *userOpQueues) RemoveOps(entryPoint common.Address, ops ...*userop.UserO
110
113
111
114
func newUserOpQueue () * userOpQueues {
112
115
return & userOpQueues {
113
- maxBatchSize : defaultMaxBatchSize ,
114
- setsByEntryPoint : make (map [common.Address ]* set ),
116
+ maxBatchSize : defaultMaxBatchSize ,
115
117
}
116
118
}
You can’t perform that action at this time.
0 commit comments