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
sidecars []*types.BlobTxSidecar
blobs int
inclusionListTxs []*types.Transaction
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.
// Note genParams.coinbase can be different with header.Coinbase
// 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 {
log.Error("Failed to create sealing context", "err", 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.
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.
state, err := miner.chain.StateAt(parent.Root)
if err != nil {
@ -281,6 +282,7 @@ func (miner *Miner) makeEnv(parent *types.Header, header *types.Header, coinbase
size: uint64(header.Size()),
coinbase: coinbase,
header: header,
inclusionListTxs: types.InclusionListToTransactions(inclusionList),
witness: state.Witness(),
evm: vm.NewEVM(core.NewEVMBlockContext(header, miner.chain, &coinbase), state, miner.chainConfig, vm.Config{}),
}, nil