• Felix Lange's avatar
    core: move TxPool reorg and events to background goroutine (#19705) · 60c062e1
    Felix Lange authored
    * core: move TxPool reorg and events to background goroutine
    
    This change moves internal queue re-shuffling work in TxPool to a
    background goroutine, TxPool.runReorg. Requests to execute runReorg are
    accumulated by the new scheduleReorgLoop. The new loop also accumulates
    transaction events.
    
    The motivation for this change is making sends to txFeed synchronous
    instead of sending them in one-off goroutines launched by 'add' and
    'promoteExecutables'. If a downstream consumer of txFeed is blocked for
    a while, reorg requests and events will queue up.
    
    * core: remove homestead check in TxPool
    
    This change removes tracking of the homestead block number from TxPool.
    The homestead field was used to enforce minimum gas of 53000 for
    contract creations after the homestead fork, but not before it. Since
    nobody would want configure a non-homestead chain nowadays and contract
    creations usually take more than 53000 gas, the extra correctness is
    redundant and can be removed.
    
    * core: fixes for review comments
    
    * core: remove BenchmarkPoolInsert
    
    This is useless now because there is no separate code path for
    individual transactions anymore.
    
    * core: fix pending counter metric
    
    * core: fix pool tests
    
    * core: dedup txpool announced events, discard stales
    
    * core: reorg tx promotion/demotion to avoid weird pending gaps
    60c062e1
tx_pool.go 51.3 KB