@@ -945,8 +945,7 @@ func (w *worker) commitBundle(env *environment, txs types.Transactions, interrup
945945 // (1) new head block event arrival, the interrupt signal is 1
946946 // (2) worker start or restart, the interrupt signal is 1
947947 // (3) worker recreate the sealing block with any newly arrived transactions, the interrupt signal is 2.
948- // For the first two cases, the semi-finished work will be discarded.
949- // For the third case, the semi-finished work will be submitted to the consensus engine.
948+ // Discard the interrupted work, since it is incomplete and contains partial bundles
950949 if interrupt != nil && atomic .LoadInt32 (interrupt ) != commitInterruptNone {
951950 // Notify resubmit loop to increase resubmitting interval due to too frequent commits.
952951 if atomic .LoadInt32 (interrupt ) == commitInterruptResubmit {
@@ -961,10 +960,11 @@ func (w *worker) commitBundle(env *environment, txs types.Transactions, interrup
961960 }
962961 return errBundleInterrupted
963962 }
964- // If we don't have enough gas for any further transactions then we're done
963+ // If we don't have enough gas for any further transactions discard the block
964+ // since not all bundles of the were applied
965965 if env .gasPool .Gas () < params .TxGas {
966966 log .Trace ("Not enough gas for further transactions" , "have" , env .gasPool , "want" , params .TxGas )
967- break
967+ return errCouldNotApplyTransaction
968968 }
969969
970970 // Error may be ignored here. The error has already been checked
@@ -1545,11 +1545,11 @@ func (w *worker) simulateBundles(env *environment, bundles []types.MevBundle, pe
15451545 simulatedBundles := []simulatedBundle {}
15461546
15471547 for _ , bundle := range bundles {
1548- state := env .state .Copy ()
1549- gasPool := new (core.GasPool ).AddGas (env .header .GasLimit )
15501548 if len (bundle .Txs ) == 0 {
15511549 continue
15521550 }
1551+ state := env .state .Copy ()
1552+ gasPool := new (core.GasPool ).AddGas (env .header .GasLimit )
15531553 simmed , err := w .computeBundleGas (env , bundle , state , gasPool , pendingTxs , 0 )
15541554
15551555 if err != nil {
0 commit comments