fn find_containing_nodes(&self, hash: H, number: N) -> Option<Vec<H>> {
		if self.entries.contains_key(&hash) {
			return None
		}

		let mut containing_keys = Vec::new();
		let mut visited = BTreeSet::new();

		// iterate vote-heads and their ancestry backwards until we find the one with
		// this target hash in that chain.
		for mut head in self.heads.iter().cloned() {
			let mut active_entry;

			loop {
				active_entry = match self.entries.get(&head) {
					Some(e) => e,
					None => break,
				};

				// if node has been checked already, break
				if !visited.insert(head.clone()) {
					break
				}

				match active_entry.in_direct_ancestry(&hash, number) {
					Some(true) => {
						// set containing node and continue search.
						containing_keys.push(head.clone());
					},
					Some(false) => {}, // nothing in this branch. continue search.
					None =>
						if let Some(prev) = active_entry.ancestor_node() {
							head = prev;
							continue // iterate backwards
						},
				}

				break
			}
		}

		Some(containing_keys)
	}
// attempts to find the containing node keys for the given hash and number.
//
// returns `None` if there is a node by that key already, and a vector
// (potentially empty) of nodes with the given block in its ancestor-edge
// otherwise.
attempts to find the containing node keys for the given hash and number.
returns `None` if there is a node by that key already, and a vector
(potentially empty) of nodes with the given block in its ancestor-edge
otherwise.
attempts to find the containing node keys for the given hash and number . returns ` None ` if there is a node by that key already and a vector ( potentially empty ) of nodes with the given block in its ancestor - edge otherwise .
fn find_containing_nodes(&self, hash: H, number: N) -> Option<Vec<H>> {
		if self.entries.contains_key(&hash) {
			return None
		}
		let mut containing_keys = Vec::new();
		let mut visited = BTreeSet::new();
		// iterate vote-heads and their ancestry backwards until we find the one with
		// this target hash in that chain.
		for mut head in self.heads.iter().cloned() {
			let mut active_entry;
			loop {
				active_entry = match self.entries.get(&head) {
					Some(e) => e,
					None => break,
				};
				// if node has been checked already, break
				if !visited.insert(head.clone()) {
					break
				}
				match active_entry.in_direct_ancestry(&hash, number) {
					Some(true) => {
						// set containing node and continue search.
						containing_keys.push(head.clone());
					},
					Some(false) => {}, // nothing in this branch. continue search.
					None =>
						if let Some(prev) = active_entry.ancestor_node() {
							head = prev;
							continue // iterate backwards
						},
				}
				break
			}
		}
		Some(containing_keys)
	}
fn find_containing_nodes ( & self , hash : H , number : N ) -> Option < Vec < H > > { if self . entries . contains_key ( & hash ) { return None } let mut containing_keys = Vec :: new ( ) ; let mut visited = BTreeSet :: new ( ) ; // iterate vote-heads and their ancestry backwards until we find the one with // this target hash in that chain. for mut head in self . heads . iter ( ) . cloned ( ) { let mut active_entry ; loop { active_entry = match self . entries . get ( & head ) { Some ( e ) => e , None => break , } ; // if node has been checked already, break if ! visited . insert ( head . clone ( ) ) { break } match active_entry . in_direct_ancestry ( & hash , number ) { Some ( true ) => { // set containing node and continue search. containing_keys . push ( head . clone ( ) ) ; } , Some ( false ) => { } , // nothing in this branch. continue search. None => if let Some ( prev ) = active_entry . ancestor_node ( ) { head = prev ; continue // iterate backwards } , } break } } Some ( containing_keys ) }
attempts to find the containing node keys for the given hash and number.
attempts to find the containing node keys for the given hash and number .
&self
hash
H
number
N
&self
hash
H
number
N