Skip to content

Commit

Permalink
ledger-tool: Remove blockstore json command (#1206)
Browse files Browse the repository at this point in the history
This command is basically an exact duplicate of the print command,
except print had OutputFormat::Display hard-coded whereas the json
command had OutputFormat::Json hard-coded.

Instead of hard-coded values, parse value of --output-format from CLI
  • Loading branch information
steviez authored May 6, 2024
1 parent 06ef0fb commit 4fc1435
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 23 deletions.
25 changes: 3 additions & 22 deletions ledger-tool/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,6 @@ pub fn blockstore_subcommands<'a, 'b>(hidden: bool) -> Vec<App<'a, 'b>> {
.about("Print all the duplicate slots in the ledger")
.settings(&hidden)
.arg(&starting_slot_arg),
SubCommand::with_name("json")
.about("Print the ledger in JSON format")
.settings(&hidden)
.arg(&starting_slot_arg)
.arg(&ending_slot_arg)
.arg(&allow_dead_slots_arg),
SubCommand::with_name("latest-optimistic-slots")
.about(
"Output up to the most recent <num-slots> optimistic slots with their hashes \
Expand Down Expand Up @@ -717,21 +711,6 @@ fn do_blockstore_process_command(ledger_path: &Path, matches: &ArgMatches<'_>) -
println!("{slot}");
}
}
("json", Some(arg_matches)) => {
let starting_slot = value_t_or_exit!(arg_matches, "starting_slot", Slot);
let ending_slot = value_t!(arg_matches, "ending_slot", Slot).unwrap_or(Slot::MAX);
let allow_dead_slots = arg_matches.is_present("allow_dead_slots");
output_ledger(
crate::open_blockstore(&ledger_path, arg_matches, AccessType::Secondary),
starting_slot,
ending_slot,
allow_dead_slots,
OutputFormat::Json,
None,
std::u64::MAX,
true,
);
}
("latest-optimistic-slots", Some(arg_matches)) => {
let blockstore =
crate::open_blockstore(&ledger_path, arg_matches, AccessType::Secondary);
Expand Down Expand Up @@ -858,12 +837,14 @@ fn do_blockstore_process_command(ledger_path: &Path, matches: &ArgMatches<'_>) -
let num_slots = value_t!(arg_matches, "num_slots", Slot).ok();
let allow_dead_slots = arg_matches.is_present("allow_dead_slots");
let only_rooted = arg_matches.is_present("only_rooted");
let output_format = OutputFormat::from_matches(arg_matches, "output_format", false);

output_ledger(
crate::open_blockstore(&ledger_path, arg_matches, AccessType::Secondary),
starting_slot,
ending_slot,
allow_dead_slots,
OutputFormat::Display,
output_format,
num_slots,
verbose_level,
only_rooted,
Expand Down
1 change: 0 additions & 1 deletion ledger-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,6 @@ fn main() {
| ("copy", Some(_))
| ("dead-slots", Some(_))
| ("duplicate-slots", Some(_))
| ("json", Some(_))
| ("latest-optimistic-slots", Some(_))
| ("list-roots", Some(_))
| ("parse_full_frozen", Some(_))
Expand Down

0 comments on commit 4fc1435

Please sign in to comment.