Fix caching data shreds as coding shreds (#6877)

This commit is contained in:
Sagar Dhawan 2019-11-12 10:29:58 -08:00 committed by GitHub
parent 4bc8fd3267
commit 5670cafda4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

View File

@ -512,7 +512,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,
); );
} }
@ -733,12 +733,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()),
)));
}
// Commit step: commit all changes to the mutable structures at once, or none at all. // Commit step: commit all changes to the mutable structures at once, or none at all.
// We don't want only a subset of these changes going through. // We don't want only a subset of these changes going through.