allow config NextFreeParaId in genesis (#3781)

* allow config NextFreeParaId in genesis

* update westend chain spec
This commit is contained in:
Xiliang Chen
2021-09-07 07:42:34 +12:00
committed by GitHub
parent 4b928b0f22
commit 4d2e94f7ce
4 changed files with 33 additions and 2 deletions
@@ -175,6 +175,25 @@ pub mod pallet {
#[pallet::storage]
pub type NextFreeParaId<T> = StorageValue<_, ParaId, ValueQuery>;
#[pallet::genesis_config]
pub struct GenesisConfig {
pub next_free_para_id: ParaId,
}
#[cfg(feature = "std")]
impl Default for GenesisConfig {
fn default() -> Self {
GenesisConfig { next_free_para_id: LOWEST_PUBLIC_ID }
}
}
#[pallet::genesis_build]
impl<T: Config> GenesisBuild<T> for GenesisConfig {
fn build(&self) {
NextFreeParaId::<T>::put(self.next_free_para_id);
}
}
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}