Fix caching data shreds as coding shreds (#6877) (#6904)

(cherry picked from commit 5670cafda4)
This commit is contained in:
mergify[bot]
2019-11-13 08:22:07 -07:00
committed by Michael Vines
parent 3f91c63110
commit ae71f2a1a9

View File

@ -505,7 +505,7 @@ impl Blocktree {
&mut index_working_set, &mut index_working_set,
&mut slot_meta_working_set, &mut slot_meta_working_set,
&mut write_batch, &mut write_batch,
&mut just_inserted_coding_shreds, &mut just_inserted_data_shreds,
&mut index_meta_time, &mut index_meta_time,
); );
} }
@ -684,12 +684,7 @@ impl Blocktree {
// Assert guaranteed by integrity checks on the shred that happen before // Assert guaranteed by integrity checks on the shred that happen before
// `insert_coding_shred` is called // `insert_coding_shred` is called
if shred.is_data() || shred_index < u64::from(shred.coding_header.position) { assert!(shred.is_code() && shred_index >= u64::from(shred.coding_header.position));
error!("Due to earlier validation, shred index must be >= pos");
return Err(BlocktreeError::InvalidShredData(Box::new(
bincode::ErrorKind::Custom("shred index < pos".to_string()),
)));
}
let set_index = shred_index - u64::from(shred.coding_header.position); let set_index = shred_index - u64::from(shred.coding_header.position);
let erasure_config = ErasureConfig::new( let erasure_config = ErasureConfig::new(