mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
paras: initialize_para_now and ParachainsCache (#4934)
This commit adds a new primitive called `ParachainsCache` to manipulate the `Parachains` storage entry in a more convenient way. Then, on top of that, this commit changes the logic of `initialize_para_now` so that it is identical to what is used for initialization of onboarding.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
use crate::{
|
||||
configuration::Pallet as Configuration,
|
||||
hrmp::{Pallet as Hrmp, *},
|
||||
paras::Pallet as Paras,
|
||||
paras::{Pallet as Paras, ParachainsCache},
|
||||
shared::Pallet as Shared,
|
||||
};
|
||||
use frame_support::{assert_ok, traits::Currency};
|
||||
@@ -26,14 +26,16 @@ type BalanceOf<T> =
|
||||
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
|
||||
fn register_parachain_with_balance<T: Config>(id: ParaId, balance: BalanceOf<T>) {
|
||||
assert_ok!(Paras::<T>::initialize_para_now(
|
||||
let mut parachains = ParachainsCache::new();
|
||||
Paras::<T>::initialize_para_now(
|
||||
&mut parachains,
|
||||
id,
|
||||
crate::paras::ParaGenesisArgs {
|
||||
&crate::paras::ParaGenesisArgs {
|
||||
parachain: true,
|
||||
genesis_head: vec![1].into(),
|
||||
validation_code: vec![1].into(),
|
||||
},
|
||||
));
|
||||
);
|
||||
T::Currency::make_free_balance_be(&id.into_account(), balance);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user