diff --git a/builder/eth_service.go b/builder/eth_service.go index a67b551285..81f2b585fb 100644 --- a/builder/eth_service.go +++ b/builder/eth_service.go @@ -46,10 +46,9 @@ func (s *EthereumService) BuildBlock(attrs *builderTypes.PayloadAttributes) (*en BeaconRoot: attrs.ParentBeaconBlockRoot, Transactions: attrs.Transactions, NoTxPool: attrs.NoTxPool, - ExtraData: attrs.ExtraData, } - payload, err := s.eth.Miner().BuildPayload(args) + payload, err := s.eth.Miner().BuildPayloadWithExtraData(args, attrs.ExtraData) if err != nil { log.Error("Failed to build payload", "err", err) return nil, err diff --git a/miner/miner.go b/miner/miner.go index 8368b96e15..3f23bf0585 100644 --- a/miner/miner.go +++ b/miner/miner.go @@ -152,7 +152,12 @@ func (miner *Miner) SetGasTip(tip *big.Int) error { // BuildPayload builds the payload according to the provided parameters. func (miner *Miner) BuildPayload(args *BuildPayloadArgs) (*Payload, error) { - return miner.buildPayload(args) + return miner.buildPayload(args, nil) +} + +// BuildPayloadWithExtraData builds the payload according to the provided parameters and extra data. +func (miner *Miner) BuildPayloadWithExtraData(args *BuildPayloadArgs, extra []byte) (*Payload, error) { + return miner.buildPayload(args, extra) } // getPending retrieves the pending block based on the current head block. diff --git a/miner/payload_building.go b/miner/payload_building.go index 7b9f361617..083c3e23e4 100644 --- a/miner/payload_building.go +++ b/miner/payload_building.go @@ -47,8 +47,6 @@ type BuildPayloadArgs struct { NoTxPool bool // Optimism addition: option to disable tx pool contents from being included Transactions []*types.Transaction // Optimism addition: txs forced into the block via engine API GasLimit *uint64 // Optimism addition: override gas limit of the block to build - - ExtraData []byte // Flashbots addition: extra data to include in the block } // Id computes an 8-byte identifier by hashing the components of the payload arguments. @@ -246,7 +244,7 @@ func (payload *Payload) stopBuilding() { } // buildPayload builds the payload according to the provided parameters. -func (miner *Miner) buildPayload(args *BuildPayloadArgs) (*Payload, error) { +func (miner *Miner) buildPayload(args *BuildPayloadArgs, extraData []byte) (*Payload, error) { if args.NoTxPool { // don't start the background payload updating job if there is no tx pool to pull from // Build the initial version with no transaction included. It should be fast // enough to run. The empty payload can at least make sure there is something @@ -263,7 +261,7 @@ func (miner *Miner) buildPayload(args *BuildPayloadArgs) (*Payload, error) { noTxs: true, txs: args.Transactions, gasLimit: args.GasLimit, - extraData: args.ExtraData, + extraData: extraData, } empty := miner.generateWork(emptyParams) if empty.err != nil { @@ -288,7 +286,7 @@ func (miner *Miner) buildPayload(args *BuildPayloadArgs) (*Payload, error) { noTxs: false, txs: args.Transactions, gasLimit: args.GasLimit, - extraData: args.ExtraData, + extraData: extraData, } // Since we skip building the empty block when using the tx pool, we need to explicitly