pub fn build_proof<Header, Hasher, BlocksI, HashesI>(
	cht_size: u64,
	cht_num: Header::Number,
	blocks: BlocksI,
	hashes: HashesI
) -> ClientResult<Vec<Vec<u8>>>
	where
		Header: HeaderT,
		Hasher: hash_db::Hasher,
		Hasher::Out: Ord + HeapSizeOf,
		BlocksI: IntoIterator<Item=Header::Number>,
		HashesI: IntoIterator<Item=ClientResult<Option<Header::Hash>>>,
{
	let transaction = build_pairs::<Header, _>(cht_size, cht_num, hashes)?
		.into_iter()
		.map(|(k, v)| (None, k, Some(v)))
		.collect::<Vec<_>>();
	let storage = InMemoryState::<Hasher>::default().update(transaction);
	let trie_storage = storage.try_into_trie_backend()
		.expect("InMemoryState::try_into_trie_backend always returns Some; qed");
	let mut total_proof = HashSet::new();
	for block in blocks.into_iter() {
		debug_assert_eq!(block_to_cht_number(cht_size, block), Some(cht_num));

		let (value, proof) = prove_read_on_trie_backend(&trie_storage, &encode_cht_key(block))?;
		assert!(value.is_some(), "we have just built trie that includes the value for block");
		total_proof.extend(proof);
	}
	Ok(total_proof.into_iter().collect())
}
/// Build CHT-based header proof.
Build CHT-based header proof.
Build CHT - based header proof .
pub fn build_proof<Header, Hasher, BlocksI, HashesI>(
	cht_size: u64,
	cht_num: Header::Number,
	blocks: BlocksI,
	hashes: HashesI
) -> ClientResult<Vec<Vec<u8>>>
	where
		Header: HeaderT,
		Hasher: hash_db::Hasher,
		Hasher::Out: Ord + HeapSizeOf,
		BlocksI: IntoIterator<Item=Header::Number>,
		HashesI: IntoIterator<Item=ClientResult<Option<Header::Hash>>>,
{
	let transaction = build_pairs::<Header, _>(cht_size, cht_num, hashes)?
		.into_iter()
		.map(|(k, v)| (None, k, Some(v)))
		.collect::<Vec<_>>();
	let storage = InMemoryState::<Hasher>::default().update(transaction);
	let trie_storage = storage.try_into_trie_backend()
		.expect("InMemoryState::try_into_trie_backend always returns Some; qed");
	let mut total_proof = HashSet::new();
	for block in blocks.into_iter() {
		debug_assert_eq!(block_to_cht_number(cht_size, block), Some(cht_num));
		let (value, proof) = prove_read_on_trie_backend(&trie_storage, &encode_cht_key(block))?;
		assert!(value.is_some(), "we have just built trie that includes the value for block");
		total_proof.extend(proof);
	}
	Ok(total_proof.into_iter().collect())
}
pub fn build_proof < Header , Hasher , BlocksI , HashesI > ( cht_size : u64 , cht_num : Header :: Number , blocks : BlocksI , hashes : HashesI ) -> ClientResult < Vec < Vec < u8 > > > where Header : HeaderT , Hasher : hash_db :: Hasher , Hasher :: Out : Ord + HeapSizeOf , BlocksI : IntoIterator < Item = Header :: Number > , HashesI : IntoIterator < Item = ClientResult < Option < Header :: Hash > > > , { let transaction = build_pairs :: < Header , _ > ( cht_size , cht_num , hashes ) ? . into_iter ( ) . map ( | ( k , v ) | ( None , k , Some ( v ) ) ) . collect :: < Vec < _ > > ( ) ; let storage = InMemoryState :: < Hasher > :: default ( ) . update ( transaction ) ; let trie_storage = storage . try_into_trie_backend ( ) . expect ( " " ) ; let mut total_proof = HashSet :: new ( ) ; for block in blocks . into_iter ( ) { debug_assert_eq ! ( block_to_cht_number ( cht_size block ) Some ( cht_num ) ) ; let ( value , proof ) = prove_read_on_trie_backend ( & trie_storage , & encode_cht_key ( block ) ) ? ; assert ! ( value is_some ( ) " " ) ; total_proof . extend ( proof ) ; } Ok ( total_proof . into_iter ( ) . collect ( ) ) }
Build CHT-based header proof.
Build CHT - based header proof .
cht_size
u64
cht_num
Header::Number
blocks
BlocksI
hashes
HashesI
cht_size
u64
cht_num
Header::Number
blocks
BlocksI
hashes
HashesI