pub fn max_key_changes_range(
		&self,
		first: NumberFor<Block>,
		last: BlockId<Block>,
	) -> error::Result<Option<(NumberFor<Block>, BlockId<Block>)>> {
		let (config, storage) = match self.require_changes_trie().ok() {
			Some((config, storage)) => (config, storage),
			None => return Ok(None),
		};
 		let first = first.as_();
		let last_num = self.backend.blockchain().expect_block_number_from_id(&last)?.as_();
		if first > last_num {
			return Err(error::ErrorKind::ChangesTrieAccessFailed("Invalid changes trie range".into()).into());
		}
 		let finalized_number = self.backend.blockchain().info()?.finalized_number;
		let oldest = storage.oldest_changes_trie_block(&config, finalized_number.as_());
		let first = As::sa(::std::cmp::max(first, oldest));
		Ok(Some((first, last)))
	}
/// Get longest range within [first; last] that is possible to use in `key_changes`
/// and `key_changes_proof` calls.
/// Range could be shortened from the beginning if some changes tries have been pruned.
/// Returns Ok(None) if changes trues are not supported.
Get longest range within [first; last] that is possible to use in `key_changes`
and `key_changes_proof` calls.
Range could be shortened from the beginning if some changes tries have been pruned.
Returns Ok(None) if changes trues are not supported.
Get longest range within [ first ; last ] that is possible to use in ` key_changes ` and ` key_changes_proof ` calls . Range could be shortened from the beginning if some changes tries have been pruned . Returns Ok ( None ) if changes trues are not supported .
pub fn max_key_changes_range(
		&self,
		first: NumberFor<Block>,
		last: BlockId<Block>,
	) -> error::Result<Option<(NumberFor<Block>, BlockId<Block>)>> {
		let (config, storage) = match self.require_changes_trie().ok() {
			Some((config, storage)) => (config, storage),
			None => return Ok(None),
		};
 		let first = first.as_();
		let last_num = self.backend.blockchain().expect_block_number_from_id(&last)?.as_();
		if first > last_num {
			return Err(error::ErrorKind::ChangesTrieAccessFailed("Invalid changes trie range".into()).into());
		}
 		let finalized_number = self.backend.blockchain().info()?.finalized_number;
		let oldest = storage.oldest_changes_trie_block(&config, finalized_number.as_());
		let first = As::sa(::std::cmp::max(first, oldest));
		Ok(Some((first, last)))
	}
pub fn max_key_changes_range ( & self , first : NumberFor < Block > , last : BlockId < Block > , ) -> error :: Result < Option < ( NumberFor < Block > , BlockId < Block > ) > > { let ( config , storage ) = match self . require_changes_trie ( ) . ok ( ) { Some ( ( config , storage ) ) => ( config , storage ) , None => return Ok ( None ) , } ; let first = first . as_ ( ) ; let last_num = self . backend . blockchain ( ) . expect_block_number_from_id ( & last ) ? . as_ ( ) ; if first > last_num { return Err ( error :: ErrorKind :: ChangesTrieAccessFailed ( " " . into ( ) ) . into ( ) ) ; } let finalized_number = self . backend . blockchain ( ) . info ( ) ? . finalized_number ; let oldest = storage . oldest_changes_trie_block ( & config , finalized_number . as_ ( ) ) ; let first = As :: sa ( :: std :: cmp :: max ( first , oldest ) ) ; Ok ( Some ( ( first , last ) ) ) }
Get longest range within [first; last] that is possible to use in `key_changes`
and `key_changes_proof` calls.
Get longest range within [ first ; last ] that is possible to use in ` key_changes ` and ` key_changes_proof ` calls .
&self
first
NumberFor<Block>
last
BlockId<Block>
&self
first
NumberFor<Block>
last
BlockId<Block>