mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
allow specific nonce in aggsig sign single call (#2696)
This commit is contained in:
parent
a2adf2dfe8
commit
bd6824ca4c
2 changed files with 4 additions and 3 deletions
|
@ -421,14 +421,15 @@ pub fn add_signatures(
|
||||||
Ok(sig)
|
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(
|
pub fn sign_single(
|
||||||
secp: &Secp256k1,
|
secp: &Secp256k1,
|
||||||
msg: &Message,
|
msg: &Message,
|
||||||
skey: &SecretKey,
|
skey: &SecretKey,
|
||||||
|
snonce: Option<&SecretKey>,
|
||||||
pubkey_sum: Option<&PublicKey>,
|
pubkey_sum: Option<&PublicKey>,
|
||||||
) -> Result<Signature, Error> {
|
) -> 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)
|
Ok(sig)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ mod test {
|
||||||
let mut msg = [0u8; 32];
|
let mut msg = [0u8; 32];
|
||||||
thread_rng().fill(&mut msg);
|
thread_rng().fill(&mut msg);
|
||||||
let msg = Message::from_slice(&msg).unwrap();
|
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 {
|
SerTest {
|
||||||
pub_key: PublicKey::from_secret_key(&secp, &sk).unwrap(),
|
pub_key: PublicKey::from_secret_key(&secp, &sk).unwrap(),
|
||||||
opt_sig: Some(sig.clone()),
|
opt_sig: Some(sig.clone()),
|
||||||
|
|
Loading…
Reference in a new issue