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

[Merged by Bors] - Fix: write post state in lcli skip-slots #4843

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 4 additions & 2 deletions lcli/src/skip_slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ pub fn run<T: EthSpec>(
}
_ => return Err("must supply either --state-path or --beacon-url".into()),
};
let mut post_state = None;

let initial_slot = state.slot();
let target_slot = initial_slot + slots;
Expand Down Expand Up @@ -140,14 +141,15 @@ pub fn run<T: EthSpec>(

let duration = Instant::now().duration_since(start);
info!("Run {}: {:?}", i, duration);
post_state = Some(state);
}

if let Some(output_path) = output_path {
if let (Some(post_state), Some(output_path)) = (post_state, output_path) {
let mut output_file = File::create(output_path)
.map_err(|e| format!("Unable to create output file: {:?}", e))?;

output_file
.write_all(&state.as_ssz_bytes())
.write_all(&post_state.as_ssz_bytes())
.map_err(|e| format!("Unable to write to output file: {:?}", e))?;
}

Expand Down