Make Blockstore::get_data_shreds_for_slot() return type consistent (#32460)
We have several other functions that return data shreds; however, these other functions map shred::Error to BlockstoreError. Make this function consistent with those and map the error.
This commit is contained in:
parent
d344ae5297
commit
04fab2b48f
|
@ -1636,14 +1636,16 @@ impl Blockstore {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn get_data_shreds_for_slot(
|
||||
&self,
|
||||
slot: Slot,
|
||||
start_index: u64,
|
||||
) -> std::result::Result<Vec<Shred>, shred::Error> {
|
||||
pub fn get_data_shreds_for_slot(&self, slot: Slot, start_index: u64) -> Result<Vec<Shred>> {
|
||||
self.slot_data_iterator(slot, start_index)
|
||||
.expect("blockstore couldn't fetch iterator")
|
||||
.map(|data| Shred::new_from_serialized_shred(data.1.to_vec()))
|
||||
.map(|(_, bytes)| {
|
||||
Shred::new_from_serialized_shred(bytes.to_vec()).map_err(|err| {
|
||||
BlockstoreError::InvalidShredData(Box::new(bincode::ErrorKind::Custom(
|
||||
format!("Could not reconstruct shred from shred payload: {err:?}"),
|
||||
)))
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue