From 2ff0b4176f0a71decd13acad17b476c5083054f0 Mon Sep 17 00:00:00 2001 From: irrun Date: Mon, 11 Nov 2024 14:48:09 +0800 Subject: [PATCH] feat: bundle simulation based on real inturn header --- miner/miner.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/miner/miner.go b/miner/miner.go index c15b06951d..4f9c5b8383 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -355,13 +355,20 @@ func (miner *Miner) prepareSimulationEnv(parent *types.Header, state *state.Stat timestamp = int64(parent.Time + 1) } + // take the next in-turn validator as coinbase + coinbase, err := miner.worker.engine.NextInTurnValidator(miner.worker.chain, parent) + if err != nil { + log.Error("Failed to get next in-turn validator", "err", err) + return nil, err + } + header := &types.Header{ ParentHash: parent.Hash(), Number: new(big.Int).Add(parent.Number, common.Big1), GasLimit: core.CalcGasLimitForBuilder(parent.GasLimit, miner.worker.config.GasCeil), Extra: miner.worker.extra, Time: uint64(timestamp), - Coinbase: miner.worker.etherbase(), + Coinbase: coinbase, } // Set baseFee and GasLimit if we are on an EIP-1559 chain