Skip to content

Commit 6ec9e65

Browse files
committed
chore: refine wlock to rlock
1 parent a775e68 commit 6ec9e65

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/txpool/legacypool/legacypool.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ func (pool *LegacyPool) stats() (int, int) {
474474
// Content retrieves the data content of the transaction pool, returning all the
475475
// pending as well as queued transactions, grouped by account and sorted by nonce.
476476
func (pool *LegacyPool) Content() (map[common.Address][]*types.Transaction, map[common.Address][]*types.Transaction) {
477-
pool.mu.Lock()
478-
defer pool.mu.Unlock()
477+
pool.mu.RLock()
478+
defer pool.mu.RUnlock()
479479

480480
pending := make(map[common.Address][]*types.Transaction, len(pool.pending))
481481
for addr, list := range pool.pending {
@@ -516,8 +516,8 @@ func (pool *LegacyPool) Pending(filter txpool.PendingFilter) map[common.Address]
516516
if filter.OnlyBlobTxs {
517517
return nil
518518
}
519-
pool.mu.Lock()
520-
defer pool.mu.Unlock()
519+
pool.mu.RLock()
520+
defer pool.mu.RUnlock()
521521

522522
// Convert the new uint256.Int types to the old big.Int ones used by the legacy pool
523523
var (

0 commit comments

Comments
 (0)