@@ -324,6 +324,13 @@ where
324
324
) ;
325
325
let flashblock_build_start_time = Instant :: now ( ) ;
326
326
let state = StateProviderDatabase :: new ( & state_provider) ;
327
+ invoke_on_first_flashblock ( flashblock_count, || {
328
+ total_gas_per_batch -= builder_tx_gas;
329
+ // saturating sub just in case, we will log an error if da_limit too small for builder_tx_da_size
330
+ if let Some ( da_limit) = total_da_per_batch. as_mut ( ) {
331
+ * da_limit = da_limit. saturating_sub ( builder_tx_da_size) ;
332
+ }
333
+ } ) ;
327
334
invoke_on_last_flashblock ( flashblock_count, last_flashblock, || {
328
335
total_gas_per_batch -= builder_tx_gas;
329
336
// saturating sub just in case, we will log an error if da_limit too small for builder_tx_da_size
@@ -367,6 +374,11 @@ where
367
374
return Ok ( ( ) ) ;
368
375
}
369
376
377
+ // TODO: temporary we add builder tx to the first flashblock too
378
+ invoke_on_first_flashblock ( flashblock_count, || {
379
+ ctx. add_builder_tx ( & mut info, & mut db, builder_tx_gas, message. clone ( ) ) ;
380
+ } ) ;
381
+
370
382
// If it is the last flashblocks, add the builder txn to the block if enabled
371
383
invoke_on_last_flashblock ( flashblock_count, last_flashblock, || {
372
384
ctx. add_builder_tx ( & mut info, & mut db, builder_tx_gas, message. clone ( ) ) ;
@@ -689,6 +701,12 @@ where
689
701
) )
690
702
}
691
703
704
+ pub fn invoke_on_first_flashblock < F : FnOnce ( ) > ( current_flashblock : u64 , fun : F ) {
705
+ if current_flashblock == 0 {
706
+ fun ( )
707
+ }
708
+ }
709
+
692
710
pub fn invoke_on_last_flashblock < F : FnOnce ( ) > (
693
711
current_flashblock : u64 ,
694
712
flashblock_limit : u64 ,
0 commit comments