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

Restore --tipset flag to snapshot export command #3027

Merged
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

- [#3126](https://github.com/ChainSafe/forest/issues/3126): Bail on database
lookup errors instead of silently ignoring them.
- [#2999](https://github.com/ChainSafe/forest/issues/2999): Restored `--tipset`
flag to `forest-cli snapshot export` to allow export at a specific tipset.

### Removed

Expand Down
9 changes: 7 additions & 2 deletions src/cli/subcommands/snapshot_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ pub enum SnapshotCommands {
/// Don't write the archive.
#[arg(long)]
dry_run: bool,
/// Tipset to start the export from, default is the chain head
#[arg(short, long)]
tipset: Option<i64>,
},

/// Fetches the most recent snapshot from a trusted, pre-defined location.
Expand Down Expand Up @@ -79,13 +82,14 @@ impl SnapshotCommands {
output_path,
skip_checksum,
dry_run,
tipset,
} => {
let chain_head = match chain_head(&config.client.rpc_token).await {
Ok(head) => head.0,
Err(_) => cli_error_and_die("Could not get network head", 1),
};

let epoch = chain_head.epoch();
let epoch = tipset.unwrap_or(chain_head.epoch());

let chain_name = chain_get_name((), &config.client.rpc_token)
.await
Expand All @@ -96,7 +100,7 @@ impl SnapshotCommands {
TrustedVendor::Forest,
chain_name,
Utc::now().date_naive(),
chain_head.epoch(),
epoch,
)),
false => output_path.clone(),
};
Expand Down Expand Up @@ -144,6 +148,7 @@ impl SnapshotCommands {
"Export completed. Snapshot located at {}",
out.display()
));
println!("\n");
Ok(())
}
Self::Fetch { directory, vendor } => {
Expand Down