mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-17 03:42:46 +00:00
add deserialize_uncompressed to GenericSignature
This commit is contained in:
@@ -40,6 +40,9 @@ pub trait TSignature<GenericPublicKey>: Sized + Clone {
|
||||
/// Deserialize `self` from compressed bytes.
|
||||
fn deserialize(bytes: &[u8]) -> Result<Self, Error>;
|
||||
|
||||
/// Serialize `self` from uncompressed bytes.
|
||||
fn deserialize_uncompressed(bytes: &[u8]) -> Result<Self, Error>;
|
||||
|
||||
/// Returns `true` if `self` is a signature across `msg` by `pubkey`.
|
||||
fn verify(&self, pubkey: &GenericPublicKey, msg: Hash256) -> bool;
|
||||
}
|
||||
|
||||
@@ -198,6 +198,10 @@ impl TSignature<blst_core::PublicKey> for blst_core::Signature {
|
||||
Self::from_bytes(bytes).map_err(Into::into)
|
||||
}
|
||||
|
||||
fn deserialize_uncompressed(bytes: &[u8]) -> Result<Self, Error> {
|
||||
Self::deserialize(bytes).map_err(Into::into)
|
||||
}
|
||||
|
||||
fn verify(&self, pubkey: &blst_core::PublicKey, msg: Hash256) -> bool {
|
||||
// Public keys have already been checked for subgroup and infinity
|
||||
// Check Signature inside function for subgroup
|
||||
|
||||
@@ -119,6 +119,10 @@ impl TSignature<PublicKey> for Signature {
|
||||
Ok(signature)
|
||||
}
|
||||
|
||||
fn deserialize_uncompressed(bytes: &[u8]) -> Result<Self, Error> {
|
||||
Self::deserialize(bytes)
|
||||
}
|
||||
|
||||
fn verify(&self, _pubkey: &PublicKey, _msg: Hash256) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user