pub fn announce_block(&mut self, hash: B::Hash) {
		let header = match self.context_data.chain.header(&BlockId::Hash(hash)) {
			Ok(Some(header)) => header,
			Ok(None) => {
				warn!("Trying to announce unknown block: {}", hash);
				return;
			}
			Err(e) => {
				warn!("Error reading block header {}: {:?}", hash, e);
				return;
			}
		};
		let hash = header.hash();

		let message = GenericMessage::BlockAnnounce(message::BlockAnnounce { header: header.clone() });

		for (who, ref mut peer) in self.context_data.peers.iter_mut() {
			trace!(target: "sync", "Reannouncing block {:?} to {}", hash, who);
			peer.known_blocks.insert(hash);
			self.network_chan.send(NetworkMsg::Outgoing(who.clone(), message.clone()))
		}
	}
/// Make sure an important block is propagated to peers.
///
/// In chain-based consensus, we often need to make sure non-best forks are
/// at least temporarily synced.
Make sure an important block is propagated to peers.
In chain-based consensus, we often need to make sure non-best forks are
at least temporarily synced.
Make sure an important block is propagated to peers . In chain - based consensus we often need to make sure non - best forks are at least temporarily synced .
pub fn announce_block(&mut self, hash: B::Hash) {
		let header = match self.context_data.chain.header(&BlockId::Hash(hash)) {
			Ok(Some(header)) => header,
			Ok(None) => {
				warn!("Trying to announce unknown block: {}", hash);
				return;
			}
			Err(e) => {
				warn!("Error reading block header {}: {:?}", hash, e);
				return;
			}
		};
		let hash = header.hash();
		let message = GenericMessage::BlockAnnounce(message::BlockAnnounce { header: header.clone() });
		for (who, ref mut peer) in self.context_data.peers.iter_mut() {
			trace!(target: "sync", "Reannouncing block {:?} to {}", hash, who);
			peer.known_blocks.insert(hash);
			self.network_chan.send(NetworkMsg::Outgoing(who.clone(), message.clone()))
		}
	}
pub fn announce_block ( & mut self , hash : B :: Hash ) { let header = match self . context_data . chain . header ( & BlockId :: Hash ( hash ) ) { Ok ( Some ( header ) ) => header , Ok ( None ) => { warn ! ( " " hash ) ; return ; } Err ( e ) => { warn ! ( " " hash e ) ; return ; } } ; let hash = header . hash ( ) ; let message = GenericMessage :: BlockAnnounce ( message :: BlockAnnounce { header : header . clone ( ) } ) ; for ( who , ref mut peer ) in self . context_data . peers . iter_mut ( ) { trace ! ( target " " " " hash who ) ; peer . known_blocks . insert ( hash ) ; self . network_chan . send ( NetworkMsg :: Outgoing ( who . clone ( ) , message . clone ( ) ) ) } }
Make sure an important block is propagated to peers.
Make sure an important block is propagated to peers .
&mut self
hash
B::Hash
&mut self
hash
B::Hash