Change lock mechanism to read lock for Content method

This commit is contained in:
rjl493456442 2025-10-17 10:37:44 +08:00 committed by GitHub
parent 1e10b985cb
commit 2684b0ef2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -456,8 +456,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 {