mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 21:31:04 +00:00
aura: export change_authorities and initialize_authorities (#11468)
* aura: export change_authorities and initialize_authorities * add docs * fix docs
This commit is contained in:
@@ -146,7 +146,11 @@ pub mod pallet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Config> Pallet<T> {
|
impl<T: Config> Pallet<T> {
|
||||||
fn change_authorities(new: WeakBoundedVec<T::AuthorityId, T::MaxAuthorities>) {
|
/// Change authorities.
|
||||||
|
///
|
||||||
|
/// The storage will be applied immediately.
|
||||||
|
/// And aura consensus log will be appended to block's log.
|
||||||
|
pub fn change_authorities(new: WeakBoundedVec<T::AuthorityId, T::MaxAuthorities>) {
|
||||||
<Authorities<T>>::put(&new);
|
<Authorities<T>>::put(&new);
|
||||||
|
|
||||||
let log = DigestItem::Consensus(
|
let log = DigestItem::Consensus(
|
||||||
@@ -156,7 +160,12 @@ impl<T: Config> Pallet<T> {
|
|||||||
<frame_system::Pallet<T>>::deposit_log(log);
|
<frame_system::Pallet<T>>::deposit_log(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn initialize_authorities(authorities: &[T::AuthorityId]) {
|
/// Initial authorities.
|
||||||
|
///
|
||||||
|
/// The storage will be applied immediately.
|
||||||
|
///
|
||||||
|
/// The authorities length must be equal or less than T::MaxAuthorities.
|
||||||
|
pub fn initialize_authorities(authorities: &[T::AuthorityId]) {
|
||||||
if !authorities.is_empty() {
|
if !authorities.is_empty() {
|
||||||
assert!(<Authorities<T>>::get().is_empty(), "Authorities are already initialized!");
|
assert!(<Authorities<T>>::get().is_empty(), "Authorities are already initialized!");
|
||||||
let bounded = <BoundedSlice<'_, _, T::MaxAuthorities>>::try_from(authorities)
|
let bounded = <BoundedSlice<'_, _, T::MaxAuthorities>>::try_from(authorities)
|
||||||
|
|||||||
Reference in New Issue
Block a user