mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Switch AuRa to dynamic keystore lookup (#3359)
This commit is contained in:
committed by
André Silva
parent
a29f5763a7
commit
d1161b7d36
@@ -3,7 +3,6 @@
|
||||
#![warn(unused_extern_crates)]
|
||||
|
||||
use std::sync::Arc;
|
||||
use log::info;
|
||||
use transaction_pool::{self, txpool::{Pool as TransactionPool}};
|
||||
use node_template_runtime::{self, GenesisConfig, opaque::Block, RuntimeApi, WASM_BINARY};
|
||||
use substrate_service::{
|
||||
@@ -15,11 +14,11 @@ use basic_authorship::ProposerFactory;
|
||||
use consensus::{import_queue, start_aura, AuraImportQueue, SlotDuration};
|
||||
use futures::prelude::*;
|
||||
use substrate_client::{self as client, LongestChain};
|
||||
use primitives::{Pair as PairT};
|
||||
use inherents::InherentDataProviders;
|
||||
use network::{config::DummyFinalityProofRequestBuilder, construct_simple_protocol};
|
||||
use substrate_executor::native_executor_instance;
|
||||
use substrate_service::construct_service_factory;
|
||||
use aura_primitives::sr25519::AuthorityPair as AuraAuthorityPair;
|
||||
|
||||
pub use substrate_executor::NativeExecutor;
|
||||
// Our native executor instance.
|
||||
@@ -66,8 +65,7 @@ construct_service_factory! {
|
||||
},
|
||||
AuthoritySetup = {
|
||||
|service: Self::FullService| {
|
||||
if let Some(key) = None::<aura_primitives::sr25519::AuthorityPair> {
|
||||
info!("Using authority key {}", key.public());
|
||||
if service.config().roles.is_authority() {
|
||||
let proposer = ProposerFactory {
|
||||
client: service.client(),
|
||||
transaction_pool: service.transaction_pool(),
|
||||
@@ -75,9 +73,8 @@ construct_service_factory! {
|
||||
let client = service.client();
|
||||
let select_chain = service.select_chain()
|
||||
.ok_or_else(|| ServiceError::SelectChainRequired)?;
|
||||
let aura = start_aura(
|
||||
let aura = start_aura::<_, _, _, _, _, AuraAuthorityPair, _, _, _>(
|
||||
SlotDuration::get_or_compute(&*client)?,
|
||||
Arc::new(key),
|
||||
client.clone(),
|
||||
select_chain,
|
||||
client,
|
||||
@@ -85,6 +82,7 @@ construct_service_factory! {
|
||||
service.network(),
|
||||
service.config().custom.inherent_data_providers.clone(),
|
||||
service.config().force_authoring,
|
||||
Some(service.keystore()),
|
||||
)?;
|
||||
service.spawn_task(Box::new(aura.select(service.on_exit()).then(|_| Ok(()))));
|
||||
}
|
||||
@@ -113,7 +111,7 @@ construct_service_factory! {
|
||||
>
|
||||
{ |config: &mut FactoryFullConfiguration<Self>, client: Arc<LightClient<Self>>| {
|
||||
let fprb = Box::new(DummyFinalityProofRequestBuilder::default()) as Box<_>;
|
||||
import_queue::<_, _, aura_primitives::sr25519::AuthorityPair>(
|
||||
import_queue::<_, _, AuraAuthorityPair>(
|
||||
SlotDuration::get_or_compute(&*client)?,
|
||||
Box::new(client.clone()),
|
||||
None,
|
||||
|
||||
Reference in New Issue
Block a user