Skip to content

Commit 2d7cc5e

Browse files
committed
Reorder verify_schnorr args to match those of verify_ecdsa
1 parent 379e128 commit 2d7cc5e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/key.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ impl XOnlyPublicKey {
13891389
msg: &[u8],
13901390
sig: &schnorr::Signature,
13911391
) -> Result<(), Error> {
1392-
secp.verify_schnorr(sig, msg, self)
1392+
secp.verify_schnorr(msg, sig, self)
13931393
}
13941394
}
13951395

src/schnorr.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl Signature {
107107
#[inline]
108108
#[cfg(feature = "global-context")]
109109
pub fn verify(&self, msg: &[u8], pk: &XOnlyPublicKey) -> Result<(), Error> {
110-
SECP256K1.verify_schnorr(self, msg, pk)
110+
SECP256K1.verify_schnorr(msg, self, pk)
111111
}
112112
}
113113

@@ -178,8 +178,8 @@ impl<C: Verification> Secp256k1<C> {
178178
/// Verifies a schnorr signature.
179179
pub fn verify_schnorr(
180180
&self,
181-
sig: &Signature,
182181
msg: &[u8],
182+
sig: &Signature,
183183
pubkey: &XOnlyPublicKey,
184184
) -> Result<(), Error> {
185185
unsafe {
@@ -262,7 +262,7 @@ mod tests {
262262

263263
let sig = sign(&secp, &msg, &kp, &mut rng);
264264

265-
assert!(secp.verify_schnorr(&sig, &msg, &pk).is_ok());
265+
assert!(secp.verify_schnorr(&msg, &sig, &pk).is_ok());
266266
}
267267
}
268268

@@ -300,7 +300,7 @@ mod tests {
300300
)
301301
.unwrap();
302302

303-
assert!(secp.verify_schnorr(&sig, &msg, &pubkey).is_ok());
303+
assert!(secp.verify_schnorr(&msg, &sig, &pubkey).is_ok());
304304
}
305305

306306
#[test]
@@ -713,7 +713,7 @@ mod tests {
713713
}
714714
let sig = Signature::from_byte_array(signature);
715715
let is_verified = if let Ok(pubkey) = XOnlyPublicKey::from_slice(&public_key) {
716-
secp.verify_schnorr(&sig, &message, &pubkey).is_ok()
716+
secp.verify_schnorr(&message, &sig, &pubkey).is_ok()
717717
} else {
718718
false
719719
};

0 commit comments

Comments
 (0)