pub fn finalize() -> T::Header {
		ExecutionPhase::kill();
		AllExtrinsicsLen::kill();

		// The following fields
		//
		// - <Events<T>>
		// - <EventCount<T>>
		// - <EventTopics<T>>
		// - <Number<T>>
		// - <ParentHash<T>>
		// - <Digest<T>>
		//
		// stay to be inspected by the client and will be cleared by `Self::initialize`.
		let number = <Number<T>>::get();
		let parent_hash = <ParentHash<T>>::get();
		let mut digest = <Digest<T>>::get();

		let extrinsics = (0..ExtrinsicCount::take().unwrap_or_default())
			.map(ExtrinsicData::take)
			.collect();
		let extrinsics_root = extrinsics_data_root::<T::Hashing>(extrinsics);

		// move block hash pruning window by one block
		let block_hash_count = T::BlockHashCount::get();
		let to_remove = number.saturating_sub(block_hash_count).saturating_sub(One::one());

		// keep genesis hash
		if !to_remove.is_zero() {
			<BlockHash<T>>::remove(to_remove);
		}

		let storage_root = T::Hash::decode(&mut &sp_io::storage::root()[..])
			.expect("Node is configured to use the same hash; qed");
		let storage_changes_root = sp_io::storage::changes_root(&parent_hash.encode());

		// we can't compute changes trie root earlier && put it to the Digest
		// because it will include all currently existing temporaries.
		if let Some(storage_changes_root) = storage_changes_root {
			let item = generic::DigestItem::ChangesTrieRoot(
				T::Hash::decode(&mut &storage_changes_root[..])
					.expect("Node is configured to use the same hash; qed")
			);
			digest.push(item);
		}

		<T::Header as traits::Header>::new(number, extrinsics_root, storage_root, parent_hash, digest)
	}
/// Remove temporary "environment" entries in storage, compute the storage root and return the
/// resulting header for this block.
Remove temporary "environment" entries in storage, compute the storage root and return the
resulting header for this block.
Remove temporary " environment " entries in storage compute the storage root and return the resulting header for this block .
pub fn finalize() -> T::Header {
		ExecutionPhase::kill();
		AllExtrinsicsLen::kill();
		// The following fields
		//
		// - <Events<T>>
		// - <EventCount<T>>
		// - <EventTopics<T>>
		// - <Number<T>>
		// - <ParentHash<T>>
		// - <Digest<T>>
		//
		// stay to be inspected by the client and will be cleared by `Self::initialize`.
		let number = <Number<T>>::get();
		let parent_hash = <ParentHash<T>>::get();
		let mut digest = <Digest<T>>::get();
		let extrinsics = (0..ExtrinsicCount::take().unwrap_or_default())
			.map(ExtrinsicData::take)
			.collect();
		let extrinsics_root = extrinsics_data_root::<T::Hashing>(extrinsics);
		// move block hash pruning window by one block
		let block_hash_count = T::BlockHashCount::get();
		let to_remove = number.saturating_sub(block_hash_count).saturating_sub(One::one());
		// keep genesis hash
		if !to_remove.is_zero() {
			<BlockHash<T>>::remove(to_remove);
		}
		let storage_root = T::Hash::decode(&mut &sp_io::storage::root()[..])
			.expect("Node is configured to use the same hash; qed");
		let storage_changes_root = sp_io::storage::changes_root(&parent_hash.encode());
		// we can't compute changes trie root earlier && put it to the Digest
		// because it will include all currently existing temporaries.
		if let Some(storage_changes_root) = storage_changes_root {
			let item = generic::DigestItem::ChangesTrieRoot(
				T::Hash::decode(&mut &storage_changes_root[..])
					.expect("Node is configured to use the same hash; qed")
			);
			digest.push(item);
		}
		<T::Header as traits::Header>::new(number, extrinsics_root, storage_root, parent_hash, digest)
	}
pub fn finalize ( ) -> T :: Header { ExecutionPhase :: kill ( ) ; AllExtrinsicsLen :: kill ( ) ; // The following fields // // - <Events<T>> // - <EventCount<T>> // - <EventTopics<T>> // - <Number<T>> // - <ParentHash<T>> // - <Digest<T>> // // stay to be inspected by the client and will be cleared by `Self::initialize`. let number = < Number < T > > :: get ( ) ; let parent_hash = < ParentHash < T > > :: get ( ) ; let mut digest = < Digest < T > > :: get ( ) ; let extrinsics = ( 0 .. ExtrinsicCount :: take ( ) . unwrap_or_default ( ) ) . map ( ExtrinsicData :: take ) . collect ( ) ; let extrinsics_root = extrinsics_data_root :: < T :: Hashing > ( extrinsics ) ; // move block hash pruning window by one block let block_hash_count = T :: BlockHashCount :: get ( ) ; let to_remove = number . saturating_sub ( block_hash_count ) . saturating_sub ( One :: one ( ) ) ; // keep genesis hash if ! to_remove . is_zero ( ) { < BlockHash < T > > :: remove ( to_remove ) ; } let storage_root = T :: Hash :: decode ( & mut & sp_io :: storage :: root ( ) [ .. ] ) . expect ( " " ) ; let storage_changes_root = sp_io :: storage :: changes_root ( & parent_hash . encode ( ) ) ; // we can't compute changes trie root earlier && put it to the Digest // because it will include all currently existing temporaries. if let Some ( storage_changes_root ) = storage_changes_root { let item = generic :: DigestItem :: ChangesTrieRoot ( T :: Hash :: decode ( & mut & storage_changes_root [ .. ] ) . expect ( " " ) ) ; digest . push ( item ) ; } < T :: Header as traits :: Header > :: new ( number , extrinsics_root , storage_root , parent_hash , digest ) }
Remove temporary "environment" entries in storage, compute the storage root and return the
resulting header for this block.
Remove temporary " environment " entries in storage compute the storage root and return the resulting header for this block .