Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process only increasing block numbers #284

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crates/rbuilder/src/live_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ where
}

pub async fn run(self) -> eyre::Result<()> {
// We keep the last block to avoid going back in time since we are now very robust about reorgs or this kind of behavior.
let mut last_processed_block: Option<u64> = None;
info!("Builder block list size: {}", self.blocklist.len(),);
info!(
"Builder coinbase address: {:?}",
Expand Down Expand Up @@ -195,8 +197,13 @@ where
);
continue;
}
// Allow only increasing blocks
if last_processed_block.map_or(false, |last_processed_block| {
payload.block() <= last_processed_block
}) {
continue;
}
// see if we can get parent header in a reasonable time

let time_to_slot = payload.timestamp() - OffsetDateTime::now_utc();
debug!(
slot = payload.slot(),
Expand Down Expand Up @@ -235,6 +242,7 @@ where
);

inc_active_slots();
last_processed_block = Some(payload.block());

if let Some(block_ctx) = BlockBuildingContext::from_attributes(
payload.payload_attributes_event.clone(),
Expand Down
Loading