Put parachain head hash into CandidateDescriptor (#2310)

* Put parachain head hash into `CandidateDescriptor`

* Update guide

* Add some checks
This commit is contained in:
Bastian Köcher
2021-01-25 13:56:17 +01:00
committed by GitHub
parent dba39c7515
commit 9563652bf2
6 changed files with 24 additions and 1 deletions
+9
View File
@@ -38,6 +38,15 @@ pub use polkadot_core_primitives::BlockNumber as RelayChainBlockNumber;
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Default, Hash))]
pub struct HeadData(#[cfg_attr(feature = "std", serde(with="bytes"))] pub Vec<u8>);
#[cfg(feature = "std")]
impl HeadData {
/// Returns the hash of this head data.
pub fn hash(&self) -> Hash {
use sp_runtime::traits::Hash;
sp_runtime::traits::BlakeTwo256::hash(&self.0)
}
}
/// Parachain validation code.
#[derive(Default, PartialEq, Eq, Clone, Encode, Decode, RuntimeDebug, derive_more::From)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Hash))]