From 6ec9e6592b4999c229a0e507511271f5cd9e801a Mon Sep 17 00:00:00 2001 From: 2020xibao <117156346+will-2012@users.noreply.github.com> Date: Fri, 28 Mar 2025 21:43:26 +0800 Subject: [PATCH] chore: refine wlock to rlock --- core/txpool/legacypool/legacypool.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/txpool/legacypool/legacypool.go b/core/txpool/legacypool/legacypool.go index 7a0095a5ad..c36c888b2d 100644 --- a/core/txpool/legacypool/legacypool.go +++ b/core/txpool/legacypool/legacypool.go @@ -474,8 +474,8 @@ func (pool *LegacyPool) stats() (int, int) { // Content retrieves the data content of the transaction pool, returning all the // pending as well as queued transactions, grouped by account and sorted by nonce. func (pool *LegacyPool) Content() (map[common.Address][]*types.Transaction, map[common.Address][]*types.Transaction) { - pool.mu.Lock() - defer pool.mu.Unlock() + pool.mu.RLock() + defer pool.mu.RUnlock() pending := make(map[common.Address][]*types.Transaction, len(pool.pending)) for addr, list := range pool.pending { @@ -516,8 +516,8 @@ func (pool *LegacyPool) Pending(filter txpool.PendingFilter) map[common.Address] if filter.OnlyBlobTxs { return nil } - pool.mu.Lock() - defer pool.mu.Unlock() + pool.mu.RLock() + defer pool.mu.RUnlock() // Convert the new uint256.Int types to the old big.Int ones used by the legacy pool var (