Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit 24e1459

Browse files
author
Darioush Jalali
authored
remove currentStateLock (#741)
1 parent 14e9d30 commit 24e1459

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

core/txpool/legacypool/legacypool.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,6 @@ type LegacyPool struct {
227227
signer types.Signer
228228
mu sync.RWMutex
229229

230-
// [currentStateLock] is required to allow concurrent access to address nonces
231-
// and balances during reorgs and gossip handling.
232-
currentStateLock sync.Mutex
233230
// closed when the transaction pool is stopped. Any goroutine can listen
234231
// to this to be notified if it should shut down.
235232
generalShutdownChan chan struct{}
@@ -685,9 +682,6 @@ func (pool *LegacyPool) validateTxBasics(tx *types.Transaction, local bool) erro
685682
// validateTx checks whether a transaction is valid according to the consensus
686683
// rules and adheres to some heuristic limits of the local node (price and size).
687684
func (pool *LegacyPool) validateTx(tx *types.Transaction, local bool) error {
688-
pool.currentStateLock.Lock()
689-
defer pool.currentStateLock.Unlock()
690-
691685
opts := &txpool.ValidationOptionsWithState{
692686
State: pool.currentState,
693687
Rules: pool.chainconfig.Rules(
@@ -1500,9 +1494,7 @@ func (pool *LegacyPool) reset(oldHead, newHead *types.Header) {
15001494
return
15011495
}
15021496
pool.currentHead.Store(newHead)
1503-
pool.currentStateLock.Lock()
15041497
pool.currentState = statedb
1505-
pool.currentStateLock.Unlock()
15061498
pool.pendingNonces = newNoncer(statedb)
15071499

15081500
// Inject any transactions discarded due to reorgs
@@ -1515,9 +1507,6 @@ func (pool *LegacyPool) reset(oldHead, newHead *types.Header) {
15151507
// future queue to the set of pending transactions. During this process, all
15161508
// invalidated transactions (low nonce, low balance) are deleted.
15171509
func (pool *LegacyPool) promoteExecutables(accounts []common.Address) []*types.Transaction {
1518-
pool.currentStateLock.Lock()
1519-
defer pool.currentStateLock.Unlock()
1520-
15211510
// Track the promoted transactions to broadcast them at once
15221511
var promoted []*types.Transaction
15231512

@@ -1724,9 +1713,6 @@ func (pool *LegacyPool) truncateQueue() {
17241713
// is always explicitly triggered by SetBaseFee and it would be unnecessary and wasteful
17251714
// to trigger a re-heap is this function
17261715
func (pool *LegacyPool) demoteUnexecutables() {
1727-
pool.currentStateLock.Lock()
1728-
defer pool.currentStateLock.Unlock()
1729-
17301716
// Iterate over all accounts and demote any non-executable transactions
17311717
gasLimit := pool.currentHead.Load().GasLimit
17321718
for addr, list := range pool.pending {

0 commit comments

Comments
 (0)