Generic keystore (#3008)

* Add KeyTypeId.

* Implement clone for sr25519::Pair.

* Extend Pair with to_raw_vec.

* Implement TypedKey for Signature and Pair.

* Add trait Public.

* Make keystore generic.

* Fixup clone.

* Fix tests.

* Update service.

* Fix imports.

* Fix build.

* Fix babe build.

* Fix subkey build.

* Make authority setup generic.

* Update node-template.

* Fix build.

* Remove unsafe code.

* Fix tests.
This commit is contained in:
David Craven
2019-07-04 13:14:55 +02:00
committed by GitHub
parent 336053f7ae
commit 51e345c901
15 changed files with 279 additions and 122 deletions
+3 -3
View File
@@ -65,8 +65,8 @@ construct_service_factory! {
FullComponents::<Factory>::new(config)
},
AuthoritySetup = {
|service: Self::FullService, key: Option<Arc<Pair>>| {
if let Some(key) = key {
|service: Self::FullService| {
if let Some(key) = service.authority_key::<Pair>() {
info!("Using authority key {}", key.public());
let proposer = Arc::new(ProposerFactory {
client: service.client(),
@@ -77,7 +77,7 @@ construct_service_factory! {
.ok_or_else(|| ServiceError::SelectChainRequired)?;
let aura = start_aura(
SlotDuration::get_or_compute(&*client)?,
key.clone(),
Arc::new(key),
client.clone(),
select_chain,
client,