mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 01:41:09 +00:00
add authorities_len for aura (#2040)
This commit is contained in:
@@ -230,6 +230,11 @@ impl<T: Config> Pallet<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Return current authorities length.
|
||||
pub fn authorities_len() -> usize {
|
||||
Authorities::<T>::decode_len().unwrap_or(0)
|
||||
}
|
||||
|
||||
/// Get the current slot from the pre-runtime digests.
|
||||
fn current_slot_from_digests() -> Option<Slot> {
|
||||
let digest = frame_system::Pallet::<T>::digest();
|
||||
@@ -363,7 +368,7 @@ impl<T: Config> FindAuthor<u32> for Pallet<T> {
|
||||
for (id, mut data) in digests.into_iter() {
|
||||
if id == AURA_ENGINE_ID {
|
||||
let slot = Slot::decode(&mut data).ok()?;
|
||||
let author_index = *slot % Self::authorities().len() as u64;
|
||||
let author_index = *slot % Self::authorities_len() as u64;
|
||||
return Some(author_index as u32)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user