@@ -65,6 +65,8 @@ pub struct FlashblocksExtraCtx {
6565 pub flashblock_index : u64 ,
6666 /// Target flashblock count
6767 pub target_flashblock_count : u64 ,
68+ /// Whether the current flashblock is the first fallback block
69+ pub is_first_fallback_block : bool ,
6870}
6971
7072impl OpPayloadBuilderCtx < FlashblocksExtraCtx > {
@@ -78,6 +80,11 @@ impl OpPayloadBuilderCtx<FlashblocksExtraCtx> {
7880 self . extra_ctx . target_flashblock_count
7981 }
8082
83+ /// Returns if the flashblock is the first fallback block
84+ pub fn is_first_fallback_block ( & self ) -> bool {
85+ self . extra_ctx . is_first_fallback_block
86+ }
87+
8188 /// Increments the flashblock index
8289 pub fn increment_flashblock_index ( & mut self ) -> u64 {
8390 self . extra_ctx . flashblock_index += 1 ;
@@ -90,6 +97,11 @@ impl OpPayloadBuilderCtx<FlashblocksExtraCtx> {
9097 self . extra_ctx . target_flashblock_count
9198 }
9299
100+ /// Sets the first fallback block flag
101+ pub fn set_first_fallback_block ( & mut self , is_first_fallback_block : bool ) {
102+ self . extra_ctx . is_first_fallback_block = is_first_fallback_block;
103+ }
104+
93105 /// Returns if the flashblock is the last one
94106 pub fn is_last_flashblock ( & self ) -> bool {
95107 self . flashblock_index ( ) == self . target_flashblock_count ( ) - 1
@@ -250,6 +262,7 @@ where
250262 extra_ctx : FlashblocksExtraCtx {
251263 flashblock_index : 0 ,
252264 target_flashblock_count : self . config . flashblocks_per_block ( ) ,
265+ is_first_fallback_block : true ,
253266 } ,
254267 } ;
255268
@@ -286,6 +299,8 @@ where
286299 self . ws_pub
287300 . publish ( & fb_payload)
288301 . map_err ( PayloadBuilderError :: other) ?;
302+ // We set the first fallback block flag to false after building the first fallback block
303+ ctx. set_first_fallback_block ( false ) ;
289304
290305 info ! (
291306 target: "payload_builder" ,
0 commit comments