Skip to content

Commit ce4c4c2

Browse files
fix: return correct flashblock index in check_for_prestate
1 parent 1a640e4 commit ce4c4c2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

crates/flashblocks/payload/src/generator.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ impl<Builder, Client, Tasks> FlashblocksPayloadJobGenerator<Client, Tasks, Build
274274
where
275275
Builder: PayloadBuilder<BuiltPayload = OpBuiltPayload>,
276276
{
277+
/// Check for any existing flashblock for the same payload id exists, and if so
278+
/// reduces all existing flashblocks into a payload, returning the payload and the
279+
/// next flashblock index to build on top of.
277280
fn check_for_pre_state(
278281
&self,
279282
attributes: &<Builder as PayloadBuilder>::Attributes,
@@ -303,7 +306,7 @@ where
303306
None,
304307
);
305308

306-
return Ok(Some((payload, flashblock.flashblock().index)));
309+
return Ok(Some((payload, flashblock.flashblock().index + 1)));
307310
}
308311
}
309312

crates/flashblocks/primitives/src/flashblocks.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ impl Flashblock {
155155
acc.base = next.flashblock.base;
156156
}
157157

158+
acc.index = next.flashblock.index;
159+
158160
acc.metadata.fees = next.flashblock.metadata.fees;
159161
acc.metadata.flashblock_timestamp = next.flashblock.metadata.flashblock_timestamp;
160162

0 commit comments

Comments
 (0)