Skip to content

Commit 3c66401

Browse files
fix: fetch authorities from validator pallet (#462)
1 parent 45ebb8d commit 3c66401

File tree

1 file changed

+9
-2
lines changed
  • substrate-node/runtime/src

1 file changed

+9
-2
lines changed

substrate-node/runtime/src/lib.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use pallet_grandpa::fg_primitives;
1111
use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
1212
use sp_api::impl_runtime_apis;
1313
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
14-
use sp_core::{crypto::KeyTypeId, Encode, OpaqueMetadata};
14+
use sp_core::{crypto::KeyTypeId, sr25519, Encode, OpaqueMetadata};
1515
use sp_runtime::traits::{
1616
AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, NumberFor, OpaqueKeys,
1717
SaturatedConversion, Verify,
@@ -832,7 +832,14 @@ impl_runtime_apis! {
832832
}
833833

834834
fn authorities() -> Vec<AuraId> {
835-
Aura::authorities().into_inner()
835+
ValidatorSet::validators()
836+
.iter()
837+
.map(|account| {
838+
let mut bytes = [0u8; 32];
839+
bytes.copy_from_slice(&account.encode());
840+
sr25519::Public::from_raw(bytes).into()
841+
})
842+
.collect()
836843
}
837844
}
838845

0 commit comments

Comments
 (0)