Skip to content

Commit

Permalink
core: fix datarace in txpool, fixes #25870 and #25869 (#25872)
Browse files Browse the repository at this point in the history
core: fix datarace in txpool pendingnoce, fixes #25870
  • Loading branch information
holiman authored Sep 26, 2022
1 parent a3c6d1d commit e004e7d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@ func (pool *TxPool) SetGasPrice(price *big.Int) {
// Nonce returns the next nonce of an account, with all transactions executable
// by the pool already applied on top.
func (pool *TxPool) Nonce(addr common.Address) uint64 {
pool.mu.RLock()
defer pool.mu.RUnlock()

return pool.pendingNonces.get(addr)
}

Expand Down

0 comments on commit e004e7d

Please sign in to comment.