Skip to content

Commit

Permalink
core: fix datarace in txpool pendingnoce, fixes ethereum#25870
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman committed Sep 26, 2022
1 parent 15b4a4b commit 4d70b6b
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 4d70b6b

Please sign in to comment.