Window service is filtering out coding shreds (#6052)
* Window service is filtering out coding shreds * update erasure stats to indicate recovery count * filter out outdated coding shreds * address review comments
This commit is contained in:
		| @@ -396,7 +396,7 @@ impl Blocktree { | |||||||
|                         set_index as usize, |                         set_index as usize, | ||||||
|                         slot, |                         slot, | ||||||
|                     ) { |                     ) { | ||||||
|                         submit_metrics(true, "complete".into()); |                         submit_metrics(true, format!("complete. recovered: {}", result.len())); | ||||||
|                         recovered_data_shreds.append(&mut result); |                         recovered_data_shreds.append(&mut result); | ||||||
|                     } else { |                     } else { | ||||||
|                         submit_metrics(true, "incomplete".into()); |                         submit_metrics(true, "incomplete".into()); | ||||||
|   | |||||||
| @@ -25,6 +25,16 @@ use std::time::{Duration, Instant}; | |||||||
|  |  | ||||||
| pub const NUM_THREADS: u32 = 10; | pub const NUM_THREADS: u32 = 10; | ||||||
|  |  | ||||||
|  | fn verify_shred_slot(shred: &Shred, root: u64) -> bool { | ||||||
|  |     if shred.is_data() { | ||||||
|  |         // Only data shreds have parent information | ||||||
|  |         blocktree::verify_shred_slots(shred.slot(), shred.parent(), root) | ||||||
|  |     } else { | ||||||
|  |         // Filter out outdated coding shreds | ||||||
|  |         shred.slot() >= root | ||||||
|  |     } | ||||||
|  | } | ||||||
|  |  | ||||||
| /// drop blobs that are from myself or not from the correct leader for the | /// drop blobs that are from myself or not from the correct leader for the | ||||||
| /// blob's slot | /// blob's slot | ||||||
| pub fn should_retransmit_and_persist( | pub fn should_retransmit_and_persist( | ||||||
| @@ -42,7 +52,7 @@ pub fn should_retransmit_and_persist( | |||||||
|         if leader_id == *my_pubkey { |         if leader_id == *my_pubkey { | ||||||
|             inc_new_counter_debug!("streamer-recv_window-circular_transmission", 1); |             inc_new_counter_debug!("streamer-recv_window-circular_transmission", 1); | ||||||
|             false |             false | ||||||
|         } else if !blocktree::verify_shred_slots(shred.slot(), shred.parent(), root) { |         } else if !verify_shred_slot(shred, root) { | ||||||
|             inc_new_counter_debug!("streamer-recv_window-outdated_transmission", 1); |             inc_new_counter_debug!("streamer-recv_window-outdated_transmission", 1); | ||||||
|             false |             false | ||||||
|         } else if !shred.verify(&leader_id) { |         } else if !shred.verify(&leader_id) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user