From 007a30802a3b66c2a3b16a977f8acad0c3f4aab4 Mon Sep 17 00:00:00 2001 From: Vitaly Drogan Date: Fri, 23 Dec 2022 17:17:25 +0200 Subject: [PATCH] Work on local devnet (#30) * Always recommit when creating blocks * Allow algo worker for local block creation --- miner/worker.go | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index a93826e8932c..33ec14834c56 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -579,11 +579,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) } @@ -1298,6 +1299,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.