From 6c2534a8be100cc95ec14dc280fdfbf0659bcb1e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 16 Jan 2020 17:27:52 -0800 Subject: [PATCH] Add logging surrounding failure in `get_slot_entries_with_shred_info()` (#7846) (#7851) automerge --- ledger/src/blockstore.rs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 2c2f8af322..40792f3457 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -1473,7 +1473,7 @@ impl Blockstore { completed_ranges .par_iter() .map(|(start_index, end_index)| { - self.get_entries_in_data_block(slot, *start_index, *end_index) + self.get_entries_in_data_block(slot, *start_index, *end_index, &slot_meta) }) .collect() }) @@ -1514,6 +1514,7 @@ impl Blockstore { slot: Slot, start_index: u32, end_index: u32, + slot_meta: &SlotMeta, ) -> Result> { let data_shred_cf = self.db.column::(); @@ -1523,10 +1524,22 @@ impl Blockstore { data_shred_cf .get_bytes((slot, u64::from(i))) .and_then(|serialized_shred| { - Shred::new_from_serialized_shred( - serialized_shred - .expect("Shred must exist if shred index was included in a range"), - ) + Shred::new_from_serialized_shred(serialized_shred.unwrap_or_else(|| { + panic!( + "Shred with + slot: {}, + index: {}, + consumed: {}, + completed_indexes: {:?} + must exist if shred index was included in a range: {} {}", + slot, + i, + slot_meta.consumed, + slot_meta.completed_data_indexes, + start_index, + end_index + ) + })) .map_err(|err| { BlockstoreError::InvalidShredData(Box::new(bincode::ErrorKind::Custom( format!(