Skip to content

Commit 2700840

Browse files
authored
core/txpool/blobpool: change rw-lock to r-lock (#29989)
1 parent c11aac2 commit 2700840

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/txpool/blobpool/blobpool.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,8 +1598,8 @@ func (p *BlobPool) SubscribeTransactions(ch chan<- core.NewTxsEvent, reorgs bool
15981598
// Nonce returns the next nonce of an account, with all transactions executable
15991599
// by the pool already applied on top.
16001600
func (p *BlobPool) Nonce(addr common.Address) uint64 {
1601-
p.lock.Lock()
1602-
defer p.lock.Unlock()
1601+
p.lock.RLock()
1602+
defer p.lock.RUnlock()
16031603

16041604
if txs, ok := p.index[addr]; ok {
16051605
return txs[len(txs)-1].nonce + 1
@@ -1610,8 +1610,8 @@ func (p *BlobPool) Nonce(addr common.Address) uint64 {
16101610
// Stats retrieves the current pool stats, namely the number of pending and the
16111611
// number of queued (non-executable) transactions.
16121612
func (p *BlobPool) Stats() (int, int) {
1613-
p.lock.Lock()
1614-
defer p.lock.Unlock()
1613+
p.lock.RLock()
1614+
defer p.lock.RUnlock()
16151615

16161616
var pending int
16171617
for _, txs := range p.index {

0 commit comments

Comments
 (0)