Skip to content

Commit

Permalink
core: fix datarace in txpool, fixes ethereum#25870 and ethereum#25869 (
Browse files Browse the repository at this point in the history
…ethereum#25872)

core: fix datarace in txpool pendingnoce, fixes ethereum#25870
  • Loading branch information
holiman authored and blakehhuynh committed Oct 3, 2022
1 parent 77a9ebc commit 84f76ca
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 84f76ca

Please sign in to comment.