miner: add inclusionListTxs to environment

This commit is contained in:
Jihoon Song 2024-11-30 17:53:18 +09:00
parent 3111ae8157
commit 8ddd60a301

View file

@ -59,6 +59,7 @@ type environment struct {
receipts []*types.Receipt receipts []*types.Receipt
sidecars []*types.BlobTxSidecar sidecars []*types.BlobTxSidecar
blobs int blobs int
inclusionListTxs []*types.Transaction
witness *stateless.Witness witness *stateless.Witness
} }
@ -246,7 +247,7 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir
// Could potentially happen if starting to mine in an odd state. // Could potentially happen if starting to mine in an odd state.
// Note genParams.coinbase can be different with header.Coinbase // Note genParams.coinbase can be different with header.Coinbase
// since clique algorithm can modify the coinbase field in header. // since clique algorithm can modify the coinbase field in header.
env, err := miner.makeEnv(parent, header, genParams.coinbase, witness) env, err := miner.makeEnv(parent, header, genParams.coinbase, genParams.inclusionList, witness)
if err != nil { if err != nil {
log.Error("Failed to create sealing context", "err", err) log.Error("Failed to create sealing context", "err", err)
return nil, err return nil, err
@ -261,7 +262,7 @@ func (miner *Miner) prepareWork(genParams *generateParams, witness bool) (*envir
} }
// makeEnv creates a new environment for the sealing block. // makeEnv creates a new environment for the sealing block.
func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase common.Address, witness bool) (*environment, error) { func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase common.Address, inclusionList types.InclusionList, witness bool) (*environment, error) {
// Retrieve the parent state to execute on top. // Retrieve the parent state to execute on top.
state, err := miner.chain.StateAt(parent.Root) state, err := miner.chain.StateAt(parent.Root)
if err != nil { if err != nil {
@ -281,6 +282,7 @@ func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase
size: uint64(header.Size()), size: uint64(header.Size()),
coinbase: coinbase, coinbase: coinbase,
header: header, header: header,
inclusionListTxs: types.InclusionListToTransactions(inclusionList),
witness: state.Witness(), witness: state.Witness(),
evm: vm.NewEVM(core.NewEVMBlockContext(header, miner.chain, &coinbase), state, miner.chainConfig, vm.Config{}), evm: vm.NewEVM(core.NewEVMBlockContext(header, miner.chain, &coinbase), state, miner.chainConfig, vm.Config{}),
}, nil }, nil