Skip to content

Commit

Permalink
Ensure we sign valset upd vexts with the correct key kind
Browse files Browse the repository at this point in the history
  • Loading branch information
sug0 committed Aug 26, 2022
1 parent e86491a commit 03904d7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions shared/src/types/vote_extensions/validator_set_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@ pub struct Vext {
}

impl Vext {
/// Creates a new signed [`Vext`].
/// Ensures `sk` is a Secp256k1 key, then creates a new signed [`Vext`].
///
/// For more information, read the docs of [`SignedVext::new`].
#[inline]
pub fn sign(&self, sk: &common::SecretKey) -> SignedVext {
SignedVext::new(sk, self.clone())
pub fn sign(&self, sk: &common::SecretKey) -> Option<SignedVext> {
use common::SecretKey::*;
match sk {
Secp256k1(_) => Some(SignedVext::new(sk, self.clone())),
_ => None,
}
}
}

Expand Down

0 comments on commit 03904d7

Please sign in to comment.