mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 02:57:57 +00:00
* Companion for #13683 * Wraps trait is not required * update lockfile for {"substrate"} --------- Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -49,9 +49,9 @@ use polkadot_primitives::{
|
||||
ValidatorSignature,
|
||||
};
|
||||
pub use rand;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_core::ByteArray;
|
||||
use sp_keystore::{Error as KeystoreError, Keystore, KeystorePtr};
|
||||
use sp_keystore::{Error as KeystoreError, KeystorePtr};
|
||||
use std::time::Duration;
|
||||
use thiserror::Error;
|
||||
|
||||
@@ -276,7 +276,7 @@ pub fn signing_key_and_index(
|
||||
keystore: &KeystorePtr,
|
||||
) -> Option<(ValidatorId, ValidatorIndex)> {
|
||||
for (i, v) in validators.iter().enumerate() {
|
||||
if Keystore::has_keys(&**keystore, &[(v.to_raw_vec(), ValidatorId::ID)]) {
|
||||
if keystore.has_keys(&[(v.to_raw_vec(), ValidatorId::ID)]) {
|
||||
return Some((v.clone(), ValidatorIndex(i as _)))
|
||||
}
|
||||
}
|
||||
@@ -292,13 +292,10 @@ pub fn sign(
|
||||
key: &ValidatorId,
|
||||
data: &[u8],
|
||||
) -> Result<Option<ValidatorSignature>, KeystoreError> {
|
||||
let signature = Keystore::sign_with(&**keystore, ValidatorId::ID, &key.into(), &data)?;
|
||||
|
||||
match signature {
|
||||
Some(sig) =>
|
||||
Ok(Some(sig.try_into().map_err(|_| KeystoreError::KeyNotSupported(ValidatorId::ID))?)),
|
||||
None => Ok(None),
|
||||
}
|
||||
let signature = keystore
|
||||
.sr25519_sign(ValidatorId::ID, key.as_ref(), data)?
|
||||
.map(|sig| sig.into());
|
||||
Ok(signature)
|
||||
}
|
||||
|
||||
/// Find the validator group the given validator index belongs to.
|
||||
|
||||
@@ -21,7 +21,7 @@ use std::num::NonZeroUsize;
|
||||
use lru::LruCache;
|
||||
|
||||
use parity_scale_codec::Encode;
|
||||
use sp_application_crypto::AppKey;
|
||||
use sp_application_crypto::AppCrypto;
|
||||
use sp_core::crypto::ByteArray;
|
||||
use sp_keystore::{Keystore, KeystorePtr};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user