Skip to content

Commit

Permalink
Work on local devnet (ethereum#30)
Browse files Browse the repository at this point in the history
* Always recommit when creating blocks

* Allow algo worker for local block creation
  • Loading branch information
dvush authored and avalonche committed Mar 9, 2023
1 parent 1d5a353 commit 007a308
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions miner/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 007a308

Please sign in to comment.