diff --git a/core/tx_pool.go b/core/tx_pool.go index 16cd7076b02e778b294a4e435b823f66cc167781..3f9ad1bada4913e7aada1583ef637781a3002a07 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -1052,7 +1052,10 @@ func (pool *TxPool) runReorg(done chan struct{}, dirtyAccounts *accountSet, even defer close(done) var promoteAddrs []common.Address - if dirtyAccounts != nil { + if dirtyAccounts != nil && reset == nil { + // Only dirty accounts need to be promoted, unless we're resetting. + // For resets, all addresses in the tx queue will be promoted and + // the flatten operation can be avoided. promoteAddrs = dirtyAccounts.flatten() } pool.mu.Lock() @@ -1065,7 +1068,7 @@ func (pool *TxPool) runReorg(done chan struct{}, dirtyAccounts *accountSet, even } } // Reset needs promote for all addresses - promoteAddrs = promoteAddrs[:0] + promoteAddrs = make([]common.Address, 0, len(pool.queue)) for addr := range pool.queue { promoteAddrs = append(promoteAddrs, addr) }