@@ -91,7 +91,23 @@ func (w *worker) makeHeader(parent *types.Block, timestamp uint64, coinBase comm
91
91
// fillTransactions retrieves the pending transactions from the txpool and fills them
92
92
// into the given sealing block. The transaction selection and ordering strategy can
93
93
// be customized with the plugin in the future.
94
- func (w * worker ) fillTransactions (env * environment ) {
94
+ func (w * worker ) fillTransactions (env * environment , l1Transactions types.Transactions ) {
95
+ if len (l1Transactions ) > 0 {
96
+ l1Txs := make (map [common.Address ]types.Transactions )
97
+ for _ , tx := range l1Transactions {
98
+ sender , _ := types .Sender (env .signer , tx )
99
+ senderTxs , ok := l1Txs [sender ]
100
+ if ok {
101
+ senderTxs = append (senderTxs , tx )
102
+ l1Txs [sender ] = senderTxs
103
+ } else {
104
+ l1Txs [sender ] = types.Transactions {tx }
105
+ }
106
+ }
107
+ txs := types .NewTransactionsByPriceAndNonce (env .signer , l1Txs , env .header .BaseFee )
108
+ w .commitTransactions (env , txs , env .header .Coinbase , nil )
109
+ }
110
+
95
111
// Split the pending transactions into locals and remotes
96
112
// Fill the block with all available pending transactions.
97
113
pending := w .eth .TxPool ().Pending (true )
@@ -123,18 +139,19 @@ func (w *worker) generateWork(genParams *generateParams) (*types.Block, *state.S
123
139
work .gasPool = new (core.GasPool ).AddGas (work .header .GasLimit )
124
140
}
125
141
126
- for _ , tx := range genParams .transactions {
127
- from , _ := types .Sender (work .signer , tx )
128
- // Start executing the transaction
129
- work .state .Prepare (tx .Hash (), work .tcount )
130
- _ , err := w .commitTransaction (work , tx , work .header .Coinbase )
131
- if err != nil {
132
- return nil , nil , nil , fmt .Errorf ("failed to force-include tx: %s type: %d sender: %s nonce: %d, err: %w" , tx .Hash (), tx .Type (), from , tx .Nonce (), err )
133
- }
134
- work .tcount ++
135
- }
142
+ //for _, tx := range genParams.transactions {
143
+ //
144
+ // from, _ := types.Sender(work.signer, tx)
145
+ // // Start executing the transaction
146
+ // work.state.Prepare(tx.Hash(), work.tcount)
147
+ // _, err := w.commitTransaction(work, tx, work.header.Coinbase)
148
+ // if err != nil {
149
+ // return nil, nil, nil, fmt.Errorf("failed to force-include tx: %s type: %d sender: %s nonce: %d, err: %w", tx.Hash(), tx.Type(), from, tx.Nonce(), err)
150
+ // }
151
+ // work.l1TxCount++
152
+ //}
136
153
137
- w .fillTransactions (work )
154
+ w .fillTransactions (work , genParams . transactions )
138
155
139
156
block , err := w .engine .FinalizeAndAssemble (w .chain , work .header , work .state , work .txs , nil , work .receipts )
140
157
if err != nil {
0 commit comments