pub fn value_at_block(&self, at: &ComplexBlockId<Block>) -> ClientResult<Option<T>> {
		let head = if at.number <= self.best_finalized_block.number {
			// if the block is older than the best known finalized block
			// => we're should search for the finalized value

			// BUT since we're not guaranteeing to provide correct values for forks
			// behind the finalized block, check if the block is finalized first
			if !chain::is_finalized_block(&self.storage, at, As::sa(::std::u64::MAX))? {
				return Ok(None);
			}

			self.best_finalized_entry.as_ref()
		} else if self.unfinalized.is_empty() {
			// there are no unfinalized entries
			// => we should search for the finalized value
			self.best_finalized_entry.as_ref()
		} else {
			// there are unfinalized entries
			// => find the fork containing given block and read from this fork
			// IF there's no matching fork, ensure that this isn't a block from a fork that has forked
			// behind the best finalized block and search at finalized fork

			match self.find_unfinalized_fork(at)? {
				Some(fork) => Some(&fork.head),
				None => match self.best_finalized_entry.as_ref() {
					Some(best_finalized_entry) if chain::is_connected_to_block(&self.storage, &best_finalized_entry.valid_from, at)? =>
						Some(best_finalized_entry),
					_ => None,
				},
			}
		};

		match head {
			Some(head) => head.search_best_before(&self.storage, at.number, true)
				.map(|e| e.and_then(|e| e.0.value)),
			None => Ok(None),
		}
	}
/// Get value valid at block.
Get value valid at block.
Get value valid at block .
pub fn value_at_block(&self, at: &ComplexBlockId<Block>) -> ClientResult<Option<T>> {
		let head = if at.number <= self.best_finalized_block.number {
			// if the block is older than the best known finalized block
			// => we're should search for the finalized value
			// BUT since we're not guaranteeing to provide correct values for forks
			// behind the finalized block, check if the block is finalized first
			if !chain::is_finalized_block(&self.storage, at, As::sa(::std::u64::MAX))? {
				return Ok(None);
			}
			self.best_finalized_entry.as_ref()
		} else if self.unfinalized.is_empty() {
			// there are no unfinalized entries
			// => we should search for the finalized value
			self.best_finalized_entry.as_ref()
		} else {
			// there are unfinalized entries
			// => find the fork containing given block and read from this fork
			// IF there's no matching fork, ensure that this isn't a block from a fork that has forked
			// behind the best finalized block and search at finalized fork
			match self.find_unfinalized_fork(at)? {
				Some(fork) => Some(&fork.head),
				None => match self.best_finalized_entry.as_ref() {
					Some(best_finalized_entry) if chain::is_connected_to_block(&self.storage, &best_finalized_entry.valid_from, at)? =>
						Some(best_finalized_entry),
					_ => None,
				},
			}
		};
		match head {
			Some(head) => head.search_best_before(&self.storage, at.number, true)
				.map(|e| e.and_then(|e| e.0.value)),
			None => Ok(None),
		}
	}
pub fn value_at_block ( & self , at : & ComplexBlockId < Block > ) -> ClientResult < Option < T > > { let head = if at . number <= self . best_finalized_block . number { // if the block is older than the best known finalized block // => we're should search for the finalized value // BUT since we're not guaranteeing to provide correct values for forks // behind the finalized block, check if the block is finalized first if ! chain :: is_finalized_block ( & self . storage , at , As :: sa ( :: std :: u64 :: MAX ) ) ? { return Ok ( None ) ; } self . best_finalized_entry . as_ref ( ) } else if self . unfinalized . is_empty ( ) { // there are no unfinalized entries // => we should search for the finalized value self . best_finalized_entry . as_ref ( ) } else { // there are unfinalized entries // => find the fork containing given block and read from this fork // IF there's no matching fork, ensure that this isn't a block from a fork that has forked // behind the best finalized block and search at finalized fork match self . find_unfinalized_fork ( at ) ? { Some ( fork ) => Some ( & fork . head ) , None => match self . best_finalized_entry . as_ref ( ) { Some ( best_finalized_entry ) if chain :: is_connected_to_block ( & self . storage , & best_finalized_entry . valid_from , at ) ? => Some ( best_finalized_entry ) , _ => None , } , } } ; match head { Some ( head ) => head . search_best_before ( & self . storage , at . number , true ) . map ( | e | e . and_then ( | e | e . 0 . value ) ) , None => Ok ( None ) , } }
Get value valid at block.
Get value valid at block .
&self
at
&ComplexBlockId<Block>
&self
at
&ComplexBlockId<Block>