mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-24 08:49:29 +00:00
core/txpool/blobpool: change rw-lock to r-lock (#29989)
This commit is contained in:
parent
c11aac249d
commit
27008408a5
1 changed files with 4 additions and 4 deletions
|
|
@ -1598,8 +1598,8 @@ func (p *BlobPool) SubscribeTransactions(ch chan<- core.NewTxsEvent, reorgs bool
|
||||||
// Nonce returns the next nonce of an account, with all transactions executable
|
// Nonce returns the next nonce of an account, with all transactions executable
|
||||||
// by the pool already applied on top.
|
// by the pool already applied on top.
|
||||||
func (p *BlobPool) Nonce(addr common.Address) uint64 {
|
func (p *BlobPool) Nonce(addr common.Address) uint64 {
|
||||||
p.lock.Lock()
|
p.lock.RLock()
|
||||||
defer p.lock.Unlock()
|
defer p.lock.RUnlock()
|
||||||
|
|
||||||
if txs, ok := p.index[addr]; ok {
|
if txs, ok := p.index[addr]; ok {
|
||||||
return txs[len(txs)-1].nonce + 1
|
return txs[len(txs)-1].nonce + 1
|
||||||
|
|
@ -1610,8 +1610,8 @@ func (p *BlobPool) Nonce(addr common.Address) uint64 {
|
||||||
// Stats retrieves the current pool stats, namely the number of pending and the
|
// Stats retrieves the current pool stats, namely the number of pending and the
|
||||||
// number of queued (non-executable) transactions.
|
// number of queued (non-executable) transactions.
|
||||||
func (p *BlobPool) Stats() (int, int) {
|
func (p *BlobPool) Stats() (int, int) {
|
||||||
p.lock.Lock()
|
p.lock.RLock()
|
||||||
defer p.lock.Unlock()
|
defer p.lock.RUnlock()
|
||||||
|
|
||||||
var pending int
|
var pending int
|
||||||
for _, txs := range p.index {
|
for _, txs := range p.index {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue