Skip to content

Commit

Permalink
remove unwraps
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Jan 31, 2024
1 parent 604c5db commit 97658e6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions bin/reth/src/commands/stage/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,16 @@ impl Command {
};

if let Some(snapshot_segment) = snapshot_segment {
let snapshot_provider = tool.provider_factory.snapshot_provider().unwrap();
let snapshot_provider = tool
.provider_factory
.snapshot_provider()
.expect("snapshot provider initialized via provider factory");
let snapshots = iter_snapshots(data_dir.snapshots_path())?;
let segment_snapshots = snapshots.get(&snapshot_segment).unwrap();
for (block_range, _) in segment_snapshots {
snapshot_provider
.delete_jar(snapshot_segment, find_fixed_range(*block_range.start()))?;
if let Some(segment_snapshots) = snapshots.get(&snapshot_segment) {
for (block_range, _) in segment_snapshots {
snapshot_provider
.delete_jar(snapshot_segment, find_fixed_range(*block_range.start()))?;
}
}
}

Expand Down

0 comments on commit 97658e6

Please sign in to comment.