mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
configuration: refactor configuration initialization (#4569)
Refactor the configuration module's initializer_on_new_session in such a way that it returns the configuration. This would make it inline with other special initialization routines like `shared`'s or `paras`. This will be useful in a following PR that will check consistency of the configuration before setting it.
This commit is contained in:
@@ -221,8 +221,6 @@ impl<T: Config> Pallet<T> {
|
||||
all_validators: Vec<ValidatorId>,
|
||||
queued: Vec<ValidatorId>,
|
||||
) {
|
||||
let prev_config = <configuration::Pallet<T>>::config();
|
||||
|
||||
let random_seed = {
|
||||
let mut buf = [0u8; 32];
|
||||
// TODO: audit usage of randomness API
|
||||
@@ -233,11 +231,9 @@ impl<T: Config> Pallet<T> {
|
||||
buf
|
||||
};
|
||||
|
||||
// We can't pass the new config into the thing that determines the new config,
|
||||
// so we don't pass the `SessionChangeNotification` into this module.
|
||||
configuration::Pallet::<T>::initializer_on_new_session(&session_index);
|
||||
|
||||
let new_config = <configuration::Pallet<T>>::config();
|
||||
let configuration::SessionChangeOutcome { prev_config, new_config } =
|
||||
configuration::Pallet::<T>::initializer_on_new_session(&session_index);
|
||||
let new_config = new_config.unwrap_or_else(|| prev_config.clone());
|
||||
|
||||
let validators = shared::Pallet::<T>::initializer_on_new_session(
|
||||
session_index,
|
||||
|
||||
Reference in New Issue
Block a user