Plumb verbose_level through ledger-tool slot subcommand (#21670)
* Add commas for readability and fix plurality in a printout * Pass verbose_level into slot subcommand instead of default to max This is useful for when a full printout isn't necessary, such as just trying to determine the slot blockhash. The equivalent behavior before this change would have been using "-vv" with the command.
This commit is contained in:
parent
31b8fd3109
commit
94b1cf47ca
|
@ -134,7 +134,7 @@ fn output_entry(
|
||||||
match method {
|
match method {
|
||||||
LedgerOutputMethod::Print => {
|
LedgerOutputMethod::Print => {
|
||||||
println!(
|
println!(
|
||||||
" Entry {} - num_hashes: {}, hashes: {}, transactions: {}",
|
" Entry {} - num_hashes: {}, hash: {}, transactions: {}",
|
||||||
entry_index,
|
entry_index,
|
||||||
entry.num_hashes,
|
entry.num_hashes,
|
||||||
entry.hash,
|
entry.hash,
|
||||||
|
@ -201,7 +201,7 @@ fn output_slot(
|
||||||
println!(" Slot Meta {:?} is_full: {}", meta, is_full);
|
println!(" Slot Meta {:?} is_full: {}", meta, is_full);
|
||||||
} else {
|
} else {
|
||||||
println!(
|
println!(
|
||||||
" num_shreds: {} parent_slot: {} num_entries: {} is_full: {}",
|
" num_shreds: {}, parent_slot: {}, num_entries: {}, is_full: {}",
|
||||||
num_shreds,
|
num_shreds,
|
||||||
meta.parent_slot,
|
meta.parent_slot,
|
||||||
entries.len(),
|
entries.len(),
|
||||||
|
@ -219,7 +219,7 @@ fn output_slot(
|
||||||
output_slot_rewards(blockstore, slot, method);
|
output_slot_rewards(blockstore, slot, method);
|
||||||
} else if verbose_level >= 1 {
|
} else if verbose_level >= 1 {
|
||||||
let mut transactions = 0;
|
let mut transactions = 0;
|
||||||
let mut hashes = 0;
|
let mut num_hashes = 0;
|
||||||
let mut program_ids = HashMap::new();
|
let mut program_ids = HashMap::new();
|
||||||
let blockhash = if let Some(entry) = entries.last() {
|
let blockhash = if let Some(entry) = entries.last() {
|
||||||
entry.hash
|
entry.hash
|
||||||
|
@ -229,7 +229,7 @@ fn output_slot(
|
||||||
|
|
||||||
for entry in entries {
|
for entry in entries {
|
||||||
transactions += entry.transactions.len();
|
transactions += entry.transactions.len();
|
||||||
hashes += entry.num_hashes;
|
num_hashes += entry.num_hashes;
|
||||||
for transaction in entry.transactions {
|
for transaction in entry.transactions {
|
||||||
let tx_signature = transaction.signatures[0];
|
let tx_signature = transaction.signatures[0];
|
||||||
let sanitize_result =
|
let sanitize_result =
|
||||||
|
@ -254,8 +254,8 @@ fn output_slot(
|
||||||
}
|
}
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
" Transactions: {} hashes: {} block_hash: {}",
|
" Transactions: {}, hashes: {}, block_hash: {}",
|
||||||
transactions, hashes, blockhash,
|
transactions, num_hashes, blockhash,
|
||||||
);
|
);
|
||||||
println!(" Programs: {:?}", program_ids);
|
println!(" Programs: {:?}", program_ids);
|
||||||
}
|
}
|
||||||
|
@ -1845,7 +1845,7 @@ fn main() {
|
||||||
slot,
|
slot,
|
||||||
allow_dead_slots,
|
allow_dead_slots,
|
||||||
&LedgerOutputMethod::Print,
|
&LedgerOutputMethod::Print,
|
||||||
std::u64::MAX,
|
verbose_level,
|
||||||
) {
|
) {
|
||||||
eprintln!("{}", err);
|
eprintln!("{}", err);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue