core: fix datarace in txpool, fixes #25870 and #25869 (#25872)

core: fix datarace in txpool pendingnoce, fixes #25870
pull/25844/head
Martin Holst Swende 2 years ago committed by GitHub
parent a3c6d1d9b6
commit e004e7d256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      core/tx_pool.go

@ -463,6 +463,9 @@ func (pool *TxPool) SetGasPrice(price *big.Int) {
// 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 (pool *TxPool) Nonce(addr common.Address) uint64 { func (pool *TxPool) Nonce(addr common.Address) uint64 {
pool.mu.RLock()
defer pool.mu.RUnlock()
return pool.pendingNonces.get(addr) return pool.pendingNonces.get(addr)
} }

Loading…
Cancel
Save