Skip to content

Commit

Permalink
Merge branch 'master' into atomic-syncer-simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyonur authored Jan 9, 2025
2 parents 998077e + 24e1459 commit cdef176
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions core/txpool/legacypool/legacypool.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@ type LegacyPool struct {
signer types.Signer
mu sync.RWMutex

// [currentStateLock] is required to allow concurrent access to address nonces
// and balances during reorgs and gossip handling.
currentStateLock sync.Mutex
// closed when the transaction pool is stopped. Any goroutine can listen
// to this to be notified if it should shut down.
generalShutdownChan chan struct{}
Expand Down Expand Up @@ -685,9 +682,6 @@ func (pool *LegacyPool) validateTxBasics(tx *types.Transaction, local bool) erro
// validateTx checks whether a transaction is valid according to the consensus
// rules and adheres to some heuristic limits of the local node (price and size).
func (pool *LegacyPool) validateTx(tx *types.Transaction, local bool) error {
pool.currentStateLock.Lock()
defer pool.currentStateLock.Unlock()

opts := &txpool.ValidationOptionsWithState{
State: pool.currentState,
Rules: pool.chainconfig.Rules(
Expand Down Expand Up @@ -1500,9 +1494,7 @@ func (pool *LegacyPool) reset(oldHead, newHead *types.Header) {
return
}
pool.currentHead.Store(newHead)
pool.currentStateLock.Lock()
pool.currentState = statedb
pool.currentStateLock.Unlock()
pool.pendingNonces = newNoncer(statedb)

// Inject any transactions discarded due to reorgs
Expand All @@ -1515,9 +1507,6 @@ func (pool *LegacyPool) reset(oldHead, newHead *types.Header) {
// future queue to the set of pending transactions. During this process, all
// invalidated transactions (low nonce, low balance) are deleted.
func (pool *LegacyPool) promoteExecutables(accounts []common.Address) []*types.Transaction {
pool.currentStateLock.Lock()
defer pool.currentStateLock.Unlock()

// Track the promoted transactions to broadcast them at once
var promoted []*types.Transaction

Expand Down Expand Up @@ -1724,9 +1713,6 @@ func (pool *LegacyPool) truncateQueue() {
// is always explicitly triggered by SetBaseFee and it would be unnecessary and wasteful
// to trigger a re-heap is this function
func (pool *LegacyPool) demoteUnexecutables() {
pool.currentStateLock.Lock()
defer pool.currentStateLock.Unlock()

// Iterate over all accounts and demote any non-executable transactions
gasLimit := pool.currentHead.Load().GasLimit
for addr, list := range pool.pending {
Expand Down

0 comments on commit cdef176

Please sign in to comment.