limits to data_header.size when combining shreds' payloads (#16708)

Shredder::deshred is ignoring data_header.size when combining shreds' payloads:
https://github.com/solana-labs/solana/blob/37b8587d4/ledger/src/shred.rs#L940-L961

Also adding more sanity checks on the alignment of data shreds indices.
This commit is contained in:
behzad nouri
2021-04-27 12:04:44 +00:00
committed by GitHub
parent 68d5aec55b
commit 0f3ac51cf1
2 changed files with 29 additions and 28 deletions

View File

@ -2948,6 +2948,8 @@ pub(crate) mod tests {
let gibberish = [0xa5u8; PACKET_DATA_SIZE];
let mut data_header = DataShredHeader::default();
data_header.flags |= DATA_COMPLETE_SHRED;
// Need to provide the right size for Shredder::deshred.
data_header.size = SIZE_OF_DATA_SHRED_PAYLOAD as u16;
let mut shred = Shred::new_empty_from_header(
ShredCommonHeader::default(),
data_header,