fn check_changes_tries_proof(
		&self,
		cht_size: u64,
		remote_roots: &BTreeMap<NumberFor<B>, B::Hash>,
		remote_roots_proof: Vec<Vec<u8>>,
	) -> ClientResult<()>
		where
			H: Hasher,
			H::Out: Ord + HeapSizeOf,
	{
		// all the checks are sharing the same storage
		let storage = create_proof_check_backend_storage(remote_roots_proof);

		// we remote_roots.keys() are sorted => we can use this to group changes tries roots
		// that are belongs to the same CHT
		let blocks = remote_roots.keys().cloned();
		cht::for_each_cht_group::<B::Header, _, _, _>(cht_size, blocks, |mut storage, _, cht_blocks| {
			// get local changes trie CHT root for given CHT
			// it should be there, because it is never pruned AND request has been composed
			// when required header has been pruned (=> replaced with CHT)
			let first_block = cht_blocks.first().cloned()
				.expect("for_each_cht_group never calls callback with empty groups");
			let local_cht_root = self.blockchain.storage().changes_trie_cht_root(cht_size, first_block)?;

			// check changes trie root for every block within CHT range
			for block in cht_blocks {
				// check if the proofs storage contains the root
				// normally this happens in when the proving backend is created, but since
				// we share the storage for multiple checks, do it here
				let mut cht_root = H::Out::default();
				cht_root.as_mut().copy_from_slice(local_cht_root.as_ref());
				if !storage.contains(&cht_root, &[]) {
					return Err(ClientErrorKind::InvalidCHTProof.into());
				}

				// check proof for single changes trie root
				let proving_backend = TrieBackend::new(storage, cht_root);
				let remote_changes_trie_root = remote_roots[&block];
				cht::check_proof_on_proving_backend::<B::Header, H>(
					local_cht_root,
					block,
					remote_changes_trie_root,
					&proving_backend)?;

				// and return the storage to use in following checks
				storage = proving_backend.into_storage();
			}

			Ok(storage)
		}, storage)
	}
/// Check CHT-based proof for changes tries roots.
Check CHT-based proof for changes tries roots.
Check CHT - based proof for changes tries roots .
fn check_changes_tries_proof(
		&self,
		cht_size: u64,
		remote_roots: &BTreeMap<NumberFor<B>, B::Hash>,
		remote_roots_proof: Vec<Vec<u8>>,
	) -> ClientResult<()>
		where
			H: Hasher,
			H::Out: Ord + HeapSizeOf,
	{
		// all the checks are sharing the same storage
		let storage = create_proof_check_backend_storage(remote_roots_proof);
		// we remote_roots.keys() are sorted => we can use this to group changes tries roots
		// that are belongs to the same CHT
		let blocks = remote_roots.keys().cloned();
		cht::for_each_cht_group::<B::Header, _, _, _>(cht_size, blocks, |mut storage, _, cht_blocks| {
			// get local changes trie CHT root for given CHT
			// it should be there, because it is never pruned AND request has been composed
			// when required header has been pruned (=> replaced with CHT)
			let first_block = cht_blocks.first().cloned()
				.expect("for_each_cht_group never calls callback with empty groups");
			let local_cht_root = self.blockchain.storage().changes_trie_cht_root(cht_size, first_block)?;
			// check changes trie root for every block within CHT range
			for block in cht_blocks {
				// check if the proofs storage contains the root
				// normally this happens in when the proving backend is created, but since
				// we share the storage for multiple checks, do it here
				let mut cht_root = H::Out::default();
				cht_root.as_mut().copy_from_slice(local_cht_root.as_ref());
				if !storage.contains(&cht_root, &[]) {
					return Err(ClientErrorKind::InvalidCHTProof.into());
				}
				// check proof for single changes trie root
				let proving_backend = TrieBackend::new(storage, cht_root);
				let remote_changes_trie_root = remote_roots[&block];
				cht::check_proof_on_proving_backend::<B::Header, H>(
					local_cht_root,
					block,
					remote_changes_trie_root,
					&proving_backend)?;
				// and return the storage to use in following checks
				storage = proving_backend.into_storage();
			}
			Ok(storage)
		}, storage)
	}
fn check_changes_tries_proof ( & self , cht_size : u64 , remote_roots : & BTreeMap < NumberFor < B > , B :: Hash > , remote_roots_proof : Vec < Vec < u8 > > , ) -> ClientResult < ( ) > where H : Hasher , H :: Out : Ord + HeapSizeOf , { // all the checks are sharing the same storage let storage = create_proof_check_backend_storage ( remote_roots_proof ) ; // we remote_roots.keys() are sorted => we can use this to group changes tries roots // that are belongs to the same CHT let blocks = remote_roots . keys ( ) . cloned ( ) ; cht :: for_each_cht_group :: < B :: Header , _ , _ , _ > ( cht_size , blocks , | mut storage , _ , cht_blocks | { // get local changes trie CHT root for given CHT // it should be there, because it is never pruned AND request has been composed // when required header has been pruned (=> replaced with CHT) let first_block = cht_blocks . first ( ) . cloned ( ) . expect ( " " ) ; let local_cht_root = self . blockchain . storage ( ) . changes_trie_cht_root ( cht_size , first_block ) ? ; // check changes trie root for every block within CHT range for block in cht_blocks { // check if the proofs storage contains the root // normally this happens in when the proving backend is created, but since // we share the storage for multiple checks, do it here let mut cht_root = H :: Out :: default ( ) ; cht_root . as_mut ( ) . copy_from_slice ( local_cht_root . as_ref ( ) ) ; if ! storage . contains ( & cht_root , & [ ] ) { return Err ( ClientErrorKind :: InvalidCHTProof . into ( ) ) ; } // check proof for single changes trie root let proving_backend = TrieBackend :: new ( storage , cht_root ) ; let remote_changes_trie_root = remote_roots [ & block ] ; cht :: check_proof_on_proving_backend :: < B :: Header , H > ( local_cht_root , block , remote_changes_trie_root , & proving_backend ) ? ; // and return the storage to use in following checks storage = proving_backend . into_storage ( ) ; } Ok ( storage ) } , storage ) }
Check CHT-based proof for changes tries roots.
Check CHT - based proof for changes tries roots .
&self
cht_size
u64
remote_roots
&BTreeMap<NumberFor<B>, B::Hash>
remote_roots_proof
Vec<Vec<u8>>
&self
cht_size
u64
remote_roots
&BTreeMap<NumberFor<B>, B::Hash>
remote_roots_proof
Vec<Vec<u8>>