allow specific nonce in aggsig sign single call (#2696)

This commit is contained in:
Yeastplume 2019-03-21 11:44:55 +00:00 committed by GitHub
parent a2adf2dfe8
commit bd6824ca4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -421,14 +421,15 @@ pub fn add_signatures(
Ok(sig)
}
/// Just a simple sig, creates its own nonce, etc
/// Just a simple sig, creates its own nonce if not provided
pub fn sign_single(
secp: &Secp256k1,
msg: &Message,
skey: &SecretKey,
snonce: Option<&SecretKey>,
pubkey_sum: Option<&PublicKey>,
) -> Result<Signature, Error> {
let sig = aggsig::sign_single(secp, &msg, skey, None, None, None, pubkey_sum, None)?;
let sig = aggsig::sign_single(secp, &msg, skey, snonce, None, None, pubkey_sum, None)?;
Ok(sig)
}

View file

@ -195,7 +195,7 @@ mod test {
let mut msg = [0u8; 32];
thread_rng().fill(&mut msg);
let msg = Message::from_slice(&msg).unwrap();
let sig = aggsig::sign_single(&secp, &msg, &sk, None).unwrap();
let sig = aggsig::sign_single(&secp, &msg, &sk, None, None).unwrap();
SerTest {
pub_key: PublicKey::from_secret_key(&secp, &sk).unwrap(),
opt_sig: Some(sig.clone()),