File tree Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Expand file tree Collapse file tree 3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ fn main() {
1919 let mut pubkeys_ref: Vec < & PublicKey > = pubkeys. iter ( ) . collect ( ) ;
2020 let pubkeys_ref = pubkeys_ref. as_mut_slice ( ) ;
2121
22- secp. musig_sort_pubkeys ( pubkeys_ref) ;
22+ secp. sort_pubkeys ( pubkeys_ref) ;
2323
2424 let mut musig_key_agg_cache = KeyAggCache :: new ( & secp, pubkeys_ref) ;
2525
Original file line number Diff line number Diff line change @@ -1620,6 +1620,8 @@ impl<'de> serde::Deserialize<'de> for XOnlyPublicKey {
16201620impl < C : Verification > Secp256k1 < C > {
16211621 /// Sort public keys using lexicographic (of compressed serialization) order.
16221622 ///
1623+ /// This is the canonical way to sort public keys for use with Musig2.
1624+ ///
16231625 /// Example:
16241626 ///
16251627 /// ```rust
@@ -1636,10 +1638,10 @@ impl<C: Verification> Secp256k1<C> {
16361638 /// # let mut pubkeys_ref: Vec<&PublicKey> = pubkeys.iter().collect();
16371639 /// # let pubkeys_ref = pubkeys_ref.as_mut_slice();
16381640 /// #
1639- /// # secp.musig_sort_pubkeys (pubkeys_ref);
1641+ /// # secp.sort_pubkeys (pubkeys_ref);
16401642 /// # }
16411643 /// ```
1642- pub fn musig_sort_pubkeys ( & self , pubkeys : & mut [ & PublicKey ] ) {
1644+ pub fn sort_pubkeys ( & self , pubkeys : & mut [ & PublicKey ] ) {
16431645 let cx = self . ctx ( ) . as_ptr ( ) ;
16441646 unsafe {
16451647 let mut pubkeys_ref = core:: slice:: from_raw_parts (
Original file line number Diff line number Diff line change @@ -281,6 +281,7 @@ impl KeyAggCache {
281281 /// ensures the same resulting `agg_pk` for the same multiset of pubkeys.
282282 /// This is useful to do before aggregating pubkeys, such that the order of pubkeys
283283 /// does not affect the combined public key.
284+ /// To do this, call [`Secp256k1::sort_pubkeys`].
284285 ///
285286 /// # Returns
286287 ///
You can’t perform that action at this time.
0 commit comments