diff --git a/miner/worker.go b/miner/worker.go index aebbb66f6f..9472f4f4c7 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -541,11 +541,12 @@ func (w *worker) newWorkLoop(recommit time.Duration) { // If sealing is running resubmit a new work cycle periodically to pull in // higher priced transactions. Disable this overhead for pending blocks. if w.isRunning() && (w.chainConfig.Clique == nil || w.chainConfig.Clique.Period > 0) { + // flashbots: disable this because there can be new bundles // Short circuit if no new transaction arrives. - if atomic.LoadInt32(&w.newTxs) == 0 { - timer.Reset(recommit) - continue - } + //if atomic.LoadInt32(&w.newTxs) == 0 { + // timer.Reset(recommit) + // continue + //} commit(true, commitInterruptResubmit) } @@ -1289,6 +1290,23 @@ func (w *worker) prepareWork(genParams *generateParams) (*environment, error) { return env, nil } +func (w *worker) fillTransactionsSelectAlgo(interrupt *int32, env *environment) (error, []types.SimulatedBundle, []types.SimulatedBundle) { + var ( + blockBundles []types.SimulatedBundle + allBundles []types.SimulatedBundle + err error + ) + switch w.flashbots.algoType { + case ALGO_GREEDY: + err, blockBundles, allBundles = w.fillTransactionsAlgoWorker(interrupt, env) + case ALGO_MEV_GETH: + err, blockBundles, allBundles = w.fillTransactions(interrupt, env) + default: + err, blockBundles, allBundles = w.fillTransactions(interrupt, env) + } + return err, blockBundles, allBundles +} + // fillTransactions retrieves the pending transactions from the txpool and fills them // into the given sealing block. The transaction selection and ordering strategy can // be customized with the plugin in the future. @@ -1420,17 +1438,8 @@ func (w *worker) generateWork(params *generateParams) (*types.Block, error) { return nil, err } - var blockBundles []types.SimulatedBundle - var allBundles []types.SimulatedBundle orderCloseTime := time.Now() - switch w.flashbots.algoType { - case ALGO_GREEDY: - err, blockBundles, allBundles = w.fillTransactionsAlgoWorker(nil, work) - case ALGO_MEV_GETH: - err, blockBundles, allBundles = w.fillTransactions(nil, work) - default: - err, blockBundles, allBundles = w.fillTransactions(nil, work) - } + err, blockBundles, allBundles := w.fillTransactionsSelectAlgo(nil, work) if err != nil { return nil, err @@ -1524,7 +1533,7 @@ func (w *worker) commitWork(interrupt *int32, noempty bool, timestamp int64) { } // Fill pending transactions from the txpool - err, _, _ = w.fillTransactions(interrupt, work) + err, _, _ = w.fillTransactionsSelectAlgo(interrupt, work) if err != nil && !errors.Is(err, errBlockInterruptedByRecommit) { work.discard() return