@@ -65,6 +65,8 @@ pub struct FlashblocksExtraCtx {
65
65
pub flashblock_index : u64 ,
66
66
/// Target flashblock count
67
67
pub target_flashblock_count : u64 ,
68
+ /// Whether the current flashblock is the first fallback block
69
+ pub is_first_fallback_block : bool ,
68
70
}
69
71
70
72
impl OpPayloadBuilderCtx < FlashblocksExtraCtx > {
@@ -78,6 +80,11 @@ impl OpPayloadBuilderCtx<FlashblocksExtraCtx> {
78
80
self . extra_ctx . target_flashblock_count
79
81
}
80
82
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
+
81
88
/// Increments the flashblock index
82
89
pub fn increment_flashblock_index ( & mut self ) -> u64 {
83
90
self . extra_ctx . flashblock_index += 1 ;
@@ -90,6 +97,11 @@ impl OpPayloadBuilderCtx<FlashblocksExtraCtx> {
90
97
self . extra_ctx . target_flashblock_count
91
98
}
92
99
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
+
93
105
/// Returns if the flashblock is the last one
94
106
pub fn is_last_flashblock ( & self ) -> bool {
95
107
self . flashblock_index ( ) == self . target_flashblock_count ( ) - 1
@@ -250,6 +262,7 @@ where
250
262
extra_ctx : FlashblocksExtraCtx {
251
263
flashblock_index : 0 ,
252
264
target_flashblock_count : self . config . flashblocks_per_block ( ) ,
265
+ is_first_fallback_block : true ,
253
266
} ,
254
267
} ;
255
268
@@ -286,6 +299,8 @@ where
286
299
self . ws_pub
287
300
. publish ( & fb_payload)
288
301
. 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 ) ;
289
304
290
305
info ! (
291
306
target: "payload_builder" ,
0 commit comments