Skip to content

Commit 657e027

Browse files
committed
miner: include inclusion list transactions when building a payload
1 parent 74dab88 commit 657e027

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

miner/worker.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,49 @@ func (miner *Miner) fillTransactions(interrupt *atomic.Int32, env *environment)
537537
return err
538538
}
539539
}
540+
541+
// Filter out inclusion list transactions that are not included in the block.
542+
isIncludedTx := make(map[common.Hash]bool)
543+
for _, tx := range env.txs {
544+
isIncludedTx[tx.Hash()] = true
545+
}
546+
547+
opts := &txpool.ValidationOptions{
548+
Config: miner.chainConfig,
549+
Accept: 0 |
550+
1<<types.LegacyTxType |
551+
1<<types.AccessListTxType |
552+
1<<types.DynamicFeeTxType |
553+
1<<types.SetCodeTxType,
554+
MaxSize: params.MaxBytesPerInclusionList,
555+
MinTip: miner.config.GasPrice,
556+
}
557+
558+
for _, tx := range env.inclusionListTxs {
559+
// Skip if a transaction is already included in the block.
560+
if isIncludedTx[tx.Hash()] {
561+
continue
562+
}
563+
564+
// EIP-7805 doesn't support blob transactions in inclusion list
565+
if tx.Type() == types.BlobTxType {
566+
continue
567+
}
568+
569+
// Skip if a transaction is intrinsically invalid.
570+
if err := txpool.ValidateTransaction(tx, env.header, env.signer, opts); err != nil {
571+
continue
572+
}
573+
574+
// Add a transaction to the block.
575+
env.state.SetTxContext(tx.Hash(), env.tcount)
576+
577+
if err := miner.commitTransaction(env, tx); err != nil {
578+
// Skip if a transaction cannot be appended at the end of the block.
579+
log.Trace("Skipping inclusion list transaction", "hash", tx.Hash(), "err", err)
580+
}
581+
}
582+
540583
return nil
541584
}
542585

0 commit comments

Comments
 (0)