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 Oct 29, 2024
1 parent b4bb734 commit 66e938e
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 66e938e

Please sign in to comment.