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 gzliudan committed Sep 19, 2024
1 parent e8ad938 commit 5beedc8
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 @@ -499,6 +499,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 5beedc8

Please sign in to comment.