Skip to content

Commit

Permalink
Fix test and assert
Browse files Browse the repository at this point in the history
  • Loading branch information
sakridge authored and Steven Czabaniuk committed Apr 23, 2021
1 parent d432e0f commit e37d33b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2948,6 +2948,7 @@ pub(crate) mod tests {
let gibberish = [0xa5u8; PACKET_DATA_SIZE];
let mut data_header = DataShredHeader::default();
data_header.flags |= DATA_COMPLETE_SHRED;
data_header.size = payload_len as u16;
let mut shred = Shred::new_empty_from_header(
ShredCommonHeader::default(),
data_header,
Expand Down
1 change: 1 addition & 0 deletions core/src/serve_repair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ mod tests {
assert_eq!(shreds[0].slot(), 1);
assert_eq!(shreds[0].index(), 0);
shreds[0].payload.push(10);
shreds[0].data_header.size = shreds[0].payload.len() as u16;
blockstore
.insert_shreds(shreds, None, false)
.expect("Expect successful ledger write");
Expand Down
2 changes: 1 addition & 1 deletion ledger/src/shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ impl Shred {
&data_header,
)
.expect("Failed to write data header into shred buffer");
assert!(data_header.size as usize >= start);
} else if common_header.shred_type == ShredType(CODING_SHRED) {
Self::serialize_obj_into(
&mut start,
Expand All @@ -407,7 +408,6 @@ impl Shred {
)
.expect("Failed to write data header into shred buffer");
}
assert!(data_header.size as usize >= start);
Shred {
common_header,
data_header,
Expand Down

0 comments on commit e37d33b

Please sign in to comment.