mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
Optimize locking in LegacyPool.Content method
Changed locking mechanism in Content method to use RLock for read operations.
This commit is contained in:
parent
7c107c2691
commit
f90ed5c81f
1 changed files with 2 additions and 2 deletions
|
|
@ -456,7 +456,7 @@ 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()
|
||||
pool.mu.RLock()
|
||||
defer pool.mu.Unlock()
|
||||
|
||||
pending := make(map[common.Address][]*types.Transaction, len(pool.pending))
|
||||
|
|
@ -492,7 +492,7 @@ func (pool *LegacyPool) Pending(filter txpool.PendingFilter) map[common.Address]
|
|||
if filter.BlobTxs {
|
||||
return nil
|
||||
}
|
||||
pool.mu.Lock()
|
||||
pool.mu.RLock()
|
||||
defer pool.mu.Unlock()
|
||||
|
||||
pending := make(map[common.Address][]*txpool.LazyTransaction, len(pool.pending))
|
||||
|
|
|
|||
Loading…
Reference in a new issue