Make last shred for an interrupted slot signed + typed (#6760)

This commit is contained in:
carllin
2019-11-06 07:25:17 -08:00
committed by Michael Vines
parent b5074d8577
commit 7ff2a44a63
3 changed files with 69 additions and 25 deletions

View File

@ -3804,7 +3804,7 @@ pub mod tests {
slot,
next_shred_index as u32,
1,
None,
Some(&[1, 1, 1]),
true,
true,
)];

View File

@ -160,22 +160,23 @@ impl Shred {
data_header.flags |= LAST_SHRED_IN_SLOT
}
let mut start = 0;
Self::serialize_obj_into(
&mut start,
SIZE_OF_COMMON_SHRED_HEADER,
&mut payload,
&common_header,
)
.expect("Failed to write header into shred buffer");
Self::serialize_obj_into(
&mut start,
SIZE_OF_DATA_SHRED_HEADER,
&mut payload,
&data_header,
)
.expect("Failed to write data header into shred buffer");
if let Some(data) = data {
let mut start = 0;
Self::serialize_obj_into(
&mut start,
SIZE_OF_COMMON_SHRED_HEADER,
&mut payload,
&common_header,
)
.expect("Failed to write header into shred buffer");
Self::serialize_obj_into(
&mut start,
SIZE_OF_DATA_SHRED_HEADER,
&mut payload,
&data_header,
)
.expect("Failed to write data header into shred buffer");
payload[start..start + data.len()].clone_from_slice(data);
}