Skip to content

Commit cd6ecb1

Browse files
committed
musig: Take references to pub nonce and part sig in partial_verify
1 parent 2d672e2 commit cd6ecb1

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

examples/musig.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ fn main() {
8484
let partial_sign2 = session.partial_sign(&secp, sec_nonce2, &keypair2, &musig_key_agg_cache);
8585

8686
let is_partial_signature_valid =
87-
session.partial_verify(&secp, &musig_key_agg_cache, partial_sign1, pub_nonce1, pubkey1);
87+
session.partial_verify(&secp, &musig_key_agg_cache, &partial_sign1, &pub_nonce1, pubkey1);
8888
assert!(is_partial_signature_valid);
8989

9090
let is_partial_signature_valid =
91-
session.partial_verify(&secp, &musig_key_agg_cache, partial_sign2, pub_nonce2, pubkey2);
91+
session.partial_verify(&secp, &musig_key_agg_cache, &partial_sign2, &pub_nonce2, pubkey2);
9292
assert!(is_partial_signature_valid);
9393

9494
let partial_sigs = [partial_sign1, partial_sign2];

src/musig.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,8 +1226,8 @@ impl Session {
12261226
/// assert!(session.partial_verify(
12271227
/// &secp,
12281228
/// &key_agg_cache,
1229-
/// partial_sig1,
1230-
/// pub_nonce1,
1229+
/// &partial_sig1,
1230+
/// &pub_nonce1,
12311231
/// pub_key1,
12321232
/// ));
12331233
/// # }
@@ -1236,8 +1236,8 @@ impl Session {
12361236
&self,
12371237
secp: &Secp256k1<C>,
12381238
key_agg_cache: &KeyAggCache,
1239-
partial_sig: PartialSignature,
1240-
pub_nonce: PublicNonce,
1239+
partial_sig: &PartialSignature,
1240+
pub_nonce: &PublicNonce,
12411241
pub_key: PublicKey,
12421242
) -> bool {
12431243
let cx = secp.ctx().as_ptr();
@@ -1591,12 +1591,12 @@ mod tests {
15911591
let partial_sign2 = session.partial_sign(&secp, sec_nonce2, &keypair2, &key_agg_cache);
15921592

15931593
// Test partial signature verification
1594-
assert!(session.partial_verify(&secp, &key_agg_cache, partial_sign1, pub_nonce1, pubkey1));
1595-
assert!(session.partial_verify(&secp, &key_agg_cache, partial_sign2, pub_nonce2, pubkey2));
1594+
assert!(session.partial_verify(&secp, &key_agg_cache, &partial_sign1, &pub_nonce1, pubkey1));
1595+
assert!(session.partial_verify(&secp, &key_agg_cache, &partial_sign2, &pub_nonce2, pubkey2));
15961596
// Test that they are invalid if you switch keys
1597-
assert!(!session.partial_verify(&secp, &key_agg_cache, partial_sign2, pub_nonce2, pubkey1));
1598-
assert!(!session.partial_verify(&secp, &key_agg_cache, partial_sign2, pub_nonce1, pubkey2));
1599-
assert!(!session.partial_verify(&secp, &key_agg_cache, partial_sign2, pub_nonce1, pubkey1));
1597+
assert!(!session.partial_verify(&secp, &key_agg_cache, &partial_sign2, &pub_nonce2, pubkey1));
1598+
assert!(!session.partial_verify(&secp, &key_agg_cache, &partial_sign2, &pub_nonce1, pubkey2));
1599+
assert!(!session.partial_verify(&secp, &key_agg_cache, &partial_sign2, &pub_nonce1, pubkey1));
16001600

16011601
// Test PartialSignature serialization/deserialization
16021602
let serialized_partial_sig = partial_sign1.serialize();

0 commit comments

Comments
 (0)