renames is_last_in_fec_set back to is_last_data (#15848)
https://github.com/solana-labs/solana/pull/10095 renamed is_last_data to is_last_in_fec_set. However, the code shows that this is actually meant to indicate where the serialized data is complete: https://github.com/solana-labs/solana/blob/420174d3d/ledger/src/shred.rs#L599-L600 https://github.com/solana-labs/solana/blob/420174d3d/ledger/src/shred.rs#L229-L231 There are multiple FEC sets for each `&[Entry]` serialized and this flag does not represent shreds last in FEC sets (only the very last one by overlap). So the name is wrong and confusing
This commit is contained in:
parent
97e5591a63
commit
3b85cbc504
|
@ -201,7 +201,7 @@ impl Shred {
|
||||||
index: u32,
|
index: u32,
|
||||||
parent_offset: u16,
|
parent_offset: u16,
|
||||||
data: Option<&[u8]>,
|
data: Option<&[u8]>,
|
||||||
is_last_in_fec_set: bool,
|
is_last_data: bool,
|
||||||
is_last_in_slot: bool,
|
is_last_in_slot: bool,
|
||||||
reference_tick: u8,
|
reference_tick: u8,
|
||||||
version: u16,
|
version: u16,
|
||||||
|
@ -226,7 +226,7 @@ impl Shred {
|
||||||
size,
|
size,
|
||||||
};
|
};
|
||||||
|
|
||||||
if is_last_in_fec_set {
|
if is_last_data {
|
||||||
data_header.flags |= DATA_COMPLETE_SHRED
|
data_header.flags |= DATA_COMPLETE_SHRED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -596,7 +596,7 @@ impl Shredder {
|
||||||
let fec_set_index =
|
let fec_set_index =
|
||||||
shred_index - (i % MAX_DATA_SHREDS_PER_FEC_BLOCK as usize) as u32;
|
shred_index - (i % MAX_DATA_SHREDS_PER_FEC_BLOCK as usize) as u32;
|
||||||
|
|
||||||
let (is_last_in_fec_set, is_last_in_slot) = {
|
let (is_last_data, is_last_in_slot) = {
|
||||||
if shred_index == last_shred_index {
|
if shred_index == last_shred_index {
|
||||||
(true, is_last_in_slot)
|
(true, is_last_in_slot)
|
||||||
} else {
|
} else {
|
||||||
|
@ -609,7 +609,7 @@ impl Shredder {
|
||||||
shred_index,
|
shred_index,
|
||||||
(self.slot - self.parent_slot) as u16,
|
(self.slot - self.parent_slot) as u16,
|
||||||
Some(shred_data),
|
Some(shred_data),
|
||||||
is_last_in_fec_set,
|
is_last_data,
|
||||||
is_last_in_slot,
|
is_last_in_slot,
|
||||||
self.reference_tick,
|
self.reference_tick,
|
||||||
self.version,
|
self.version,
|
||||||
|
@ -1082,7 +1082,7 @@ pub fn verify_test_data_shred(
|
||||||
pk: &Pubkey,
|
pk: &Pubkey,
|
||||||
verify: bool,
|
verify: bool,
|
||||||
is_last_in_slot: bool,
|
is_last_in_slot: bool,
|
||||||
is_last_in_fec_set: bool,
|
is_last_data: bool,
|
||||||
) {
|
) {
|
||||||
assert_eq!(shred.payload.len(), SHRED_PAYLOAD_SIZE);
|
assert_eq!(shred.payload.len(), SHRED_PAYLOAD_SIZE);
|
||||||
assert!(shred.is_data());
|
assert!(shred.is_data());
|
||||||
|
@ -1095,7 +1095,7 @@ pub fn verify_test_data_shred(
|
||||||
} else {
|
} else {
|
||||||
assert!(!shred.last_in_slot());
|
assert!(!shred.last_in_slot());
|
||||||
}
|
}
|
||||||
if is_last_in_fec_set {
|
if is_last_data {
|
||||||
assert!(shred.data_complete());
|
assert!(shred.data_complete());
|
||||||
} else {
|
} else {
|
||||||
assert!(!shred.data_complete());
|
assert!(!shred.data_complete());
|
||||||
|
|
Loading…
Reference in New Issue