pub fn polish_block(block: &mut Block) {
	let header = &mut block.header;

	// check transaction trie root represents the transactions.
	let txs = block.extrinsics.iter().map(Encode::encode).collect::<Vec<_>>();
	let txs = txs.iter().map(Vec::as_slice).collect::<Vec<_>>();
	let txs_root = enumerated_trie_root::<Blake2Hasher>(&txs).into();
	info_expect_equal_hash(&txs_root, &header.extrinsics_root);
	header.extrinsics_root = txs_root;

	// execute transactions
	block.extrinsics.iter().enumerate().for_each(|(i, e)| {
		storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &(i as u32));
		execute_transaction_backend(e).unwrap_or_else(|_| panic!("Invalid transaction"));
		storage::unhashed::kill(well_known_keys::EXTRINSIC_INDEX);
	});

	header.state_root = storage_root().into();

	// check digest
	let mut digest = Digest::default();
	if let Some(storage_changes_root) = storage_changes_root(header.parent_hash.into(), header.number - 1) {
		digest.push(generic::DigestItem::ChangesTrieRoot(storage_changes_root.into()));
	}
	if let Some(new_authorities) = <NewAuthorities>::take() {
		digest.push(generic::DigestItem::AuthoritiesChange(new_authorities));
	}
	header.digest = digest;
}
/// Actually execute all transitioning for `block`.
Actually execute all transitioning for `block`.
Actually execute all transitioning for ` block ` .
pub fn polish_block(block: &mut Block) {
	let header = &mut block.header;
	// check transaction trie root represents the transactions.
	let txs = block.extrinsics.iter().map(Encode::encode).collect::<Vec<_>>();
	let txs = txs.iter().map(Vec::as_slice).collect::<Vec<_>>();
	let txs_root = enumerated_trie_root::<Blake2Hasher>(&txs).into();
	info_expect_equal_hash(&txs_root, &header.extrinsics_root);
	header.extrinsics_root = txs_root;
	// execute transactions
	block.extrinsics.iter().enumerate().for_each(|(i, e)| {
		storage::unhashed::put(well_known_keys::EXTRINSIC_INDEX, &(i as u32));
		execute_transaction_backend(e).unwrap_or_else(|_| panic!("Invalid transaction"));
		storage::unhashed::kill(well_known_keys::EXTRINSIC_INDEX);
	});
	header.state_root = storage_root().into();
	// check digest
	let mut digest = Digest::default();
	if let Some(storage_changes_root) = storage_changes_root(header.parent_hash.into(), header.number - 1) {
		digest.push(generic::DigestItem::ChangesTrieRoot(storage_changes_root.into()));
	}
	if let Some(new_authorities) = <NewAuthorities>::take() {
		digest.push(generic::DigestItem::AuthoritiesChange(new_authorities));
	}
	header.digest = digest;
}
pub fn polish_block ( block : & mut Block ) { let header = & mut block . header ; // check transaction trie root represents the transactions. let txs = block . extrinsics . iter ( ) . map ( Encode :: encode ) . collect :: < Vec < _ > > ( ) ; let txs = txs . iter ( ) . map ( Vec :: as_slice ) . collect :: < Vec < _ > > ( ) ; let txs_root = enumerated_trie_root :: < Blake2Hasher > ( & txs ) . into ( ) ; info_expect_equal_hash ( & txs_root , & header . extrinsics_root ) ; header . extrinsics_root = txs_root ; // execute transactions block . extrinsics . iter ( ) . enumerate ( ) . for_each ( | ( i , e ) | { storage :: unhashed :: put ( well_known_keys :: EXTRINSIC_INDEX , & ( i as u32 ) ) ; execute_transaction_backend ( e ) . unwrap_or_else ( | _ | panic ! ( " " ) ) ; storage :: unhashed :: kill ( well_known_keys :: EXTRINSIC_INDEX ) ; } ) ; header . state_root = storage_root ( ) . into ( ) ; // check digest let mut digest = Digest :: default ( ) ; if let Some ( storage_changes_root ) = storage_changes_root ( header . parent_hash . into ( ) , header . number - 1 ) { digest . push ( generic :: DigestItem :: ChangesTrieRoot ( storage_changes_root . into ( ) ) ) ; } if let Some ( new_authorities ) = < NewAuthorities > :: take ( ) { digest . push ( generic :: DigestItem :: AuthoritiesChange ( new_authorities ) ) ; } header . digest = digest ; }
Actually execute all transitioning for `block`.
Actually execute all transitioning for ` block ` .
block
&mut Block
block
&mut Block