pub fn insert(&mut self, start: NumberFor<B>, blocks: Vec<message::BlockData<B>>, who: PeerId) {
		if blocks.is_empty() {
			return;
		}

		match self.blocks.get(&start) {
			Some(&BlockRangeState::Downloading { .. }) => {
				trace!(target: "sync", "Ignored block data still marked as being downloaded: {}", start);
				debug_assert!(false);
				return;
			},
			Some(&BlockRangeState::Complete(ref existing)) if existing.len() >= blocks.len() => {
				trace!(target: "sync", "Ignored block data already downloaded: {}", start);
				return;
			},
			_ => (),
		}

		self.blocks.insert(start, BlockRangeState::Complete(blocks.into_iter()
			.map(|b| BlockData { origin: Some(who.clone()), block: b }).collect()));
	}
/// Insert a set of blocks into collection.
Insert a set of blocks into collection.
Insert a set of blocks into collection .
pub fn insert(&mut self, start: NumberFor<B>, blocks: Vec<message::BlockData<B>>, who: PeerId) {
		if blocks.is_empty() {
			return;
		}
		match self.blocks.get(&start) {
			Some(&BlockRangeState::Downloading { .. }) => {
				trace!(target: "sync", "Ignored block data still marked as being downloaded: {}", start);
				debug_assert!(false);
				return;
			},
			Some(&BlockRangeState::Complete(ref existing)) if existing.len() >= blocks.len() => {
				trace!(target: "sync", "Ignored block data already downloaded: {}", start);
				return;
			},
			_ => (),
		}
		self.blocks.insert(start, BlockRangeState::Complete(blocks.into_iter()
			.map(|b| BlockData { origin: Some(who.clone()), block: b }).collect()));
	}
pub fn insert ( & mut self , start : NumberFor < B > , blocks : Vec < message :: BlockData < B > > , who : PeerId ) { if blocks . is_empty ( ) { return ; } match self . blocks . get ( & start ) { Some ( & BlockRangeState :: Downloading { .. } ) => { trace ! ( target " " " " start ) ; debug_assert ! ( false ) ; return ; } , Some ( & BlockRangeState :: Complete ( ref existing ) ) if existing . len ( ) >= blocks . len ( ) => { trace ! ( target " " " " start ) ; return ; } , _ => ( ) , } self . blocks . insert ( start , BlockRangeState :: Complete ( blocks . into_iter ( ) . map ( | b | BlockData { origin : Some ( who . clone ( ) ) , block : b } ) . collect ( ) ) ) ; }
Insert a set of blocks into collection.
Insert a set of blocks into collection .
&mut self
start
NumberFor<B>
blocks
Vec<message::BlockData<B>>
who
PeerId
&mut self
start
NumberFor<B>
blocks
Vec<message::BlockData<B>>
who
PeerId