Skip to content
Snippets Groups Projects
Commit ba96e8a8 authored by yjh's avatar yjh Committed by GitHub
Browse files

aura: export change_authorities and initialize_authorities (#11468)

* aura: export change_authorities and initialize_authorities

* add docs

* fix docs
parent a084dd68
No related branches found
No related tags found
No related merge requests found
......@@ -146,7 +146,11 @@ pub mod pallet {
}
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);
let log = DigestItem::Consensus(
......@@ -156,7 +160,12 @@ impl<T: Config> Pallet<T> {
<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() {
assert!(<Authorities<T>>::get().is_empty(), "Authorities are already initialized!");
let bounded = <BoundedSlice<'_, _, T::MaxAuthorities>>::try_from(authorities)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment