@@ -168,24 +168,16 @@ pub trait MiniscriptKey: Clone + Eq + Ord + fmt::Debug + fmt::Display + hash::Ha
168168 /// Only >1 for keys in BIP389 multipath descriptors.
169169 fn num_der_paths ( & self ) -> usize { 0 }
170170
171- /// The associated [`sha256::Hash`] for this `MiniscriptKey`, used in the sha256 fragment.
172- ///
173- /// [`sha256::Hash`]: bitcoin::hashes::sha256::Hash
171+ /// The type used in the sha256 fragment.
174172 type Sha256 : Clone + Eq + Ord + fmt:: Display + fmt:: Debug + hash:: Hash ;
175173
176- /// The associated [`hash256::Hash`] for this `MiniscriptKey`, used in the hash256 fragment.
177- ///
178- /// [`hash256::Hash`]: crate::hash256::Hash
174+ /// The type used in the hash256 fragment.
179175 type Hash256 : Clone + Eq + Ord + fmt:: Display + fmt:: Debug + hash:: Hash ;
180176
181- /// The associated [`ripemd160::Hash`] for this `MiniscriptKey` type, used in the ripemd160 fragment.
182- ///
183- /// [`ripemd160::Hash`]: bitcoin::hashes::ripemd160::Hash
177+ /// The type used in the ripemd160 fragment.
184178 type Ripemd160 : Clone + Eq + Ord + fmt:: Display + fmt:: Debug + hash:: Hash ;
185179
186- /// The associated [`hash160::Hash`] for this `MiniscriptKey` type, used in the hash160 fragment.
187- ///
188- /// [`hash160::Hash`]: bitcoin::hashes::hash160::Hash
180+ /// The type used in the hash160 fragment.
189181 type Hash160 : Clone + Eq + Ord + fmt:: Display + fmt:: Debug + hash:: Hash ;
190182}
191183
@@ -221,38 +213,46 @@ impl MiniscriptKey for String {
221213 type Hash160 = String ;
222214}
223215
224- /// Trait describing public key types which can be converted to bitcoin pubkeys
216+ /// Trait describing key types that can be converted to bitcoin public keys.
225217pub trait ToPublicKey : MiniscriptKey {
226- /// Converts an object to a public key
218+ /// Converts key to a public key.
227219 fn to_public_key ( & self ) -> bitcoin:: PublicKey ;
228220
229- /// Convert an object to x-only pubkey
221+ /// Converts key to an x-only public key.
230222 fn to_x_only_pubkey ( & self ) -> bitcoin:: secp256k1:: XOnlyPublicKey {
231223 let pk = self . to_public_key ( ) ;
232224 bitcoin:: secp256k1:: XOnlyPublicKey :: from ( pk. inner )
233225 }
234226
235- /// Obtain the public key hash for this MiniscriptKey
236- /// Expects an argument to specify the signature type.
237- /// This would determine whether to serialize the key as 32 byte x-only pubkey
238- /// or regular public key when computing the hash160
227+ /// Obtains the pubkey hash for this key (as a ` MiniscriptKey`).
228+ ///
229+ /// Expects an argument to specify the signature type. This determines whether to serialize
230+ /// the key as 32 byte x-only pubkey or regular public key when computing the hash160.
239231 fn to_pubkeyhash ( & self , sig_type : SigType ) -> hash160:: Hash {
240232 match sig_type {
241233 SigType :: Ecdsa => hash160:: Hash :: hash ( & self . to_public_key ( ) . to_bytes ( ) ) ,
242234 SigType :: Schnorr => hash160:: Hash :: hash ( & self . to_x_only_pubkey ( ) . serialize ( ) ) ,
243235 }
244236 }
245237
246- /// Converts the generic associated [`MiniscriptKey::Sha256`] to [`sha256::Hash`]
238+ /// Converts the associated [`MiniscriptKey::Sha256`] type to a [`sha256::Hash`].
239+ ///
240+ /// [`sha256::Hash`]: bitcoin::hashes::sha256::Hash
247241 fn to_sha256 ( hash : & <Self as MiniscriptKey >:: Sha256 ) -> sha256:: Hash ;
248242
249- /// Converts the generic associated [`MiniscriptKey::Hash256`] to [`hash256::Hash`]
243+ /// Converts the associated [`MiniscriptKey::Hash256`] type to a [`hash256::Hash`].
244+ ///
245+ /// [`hash256::Hash`]: crate::hash256::Hash
250246 fn to_hash256 ( hash : & <Self as MiniscriptKey >:: Hash256 ) -> hash256:: Hash ;
251247
252- /// Converts the generic associated [`MiniscriptKey::Ripemd160`] to [`ripemd160::Hash`]
248+ /// Converts the associated [`MiniscriptKey::Ripemd160`] type to a [`ripemd160::Hash`].
249+ ///
250+ /// [`ripemd160::Hash`]: bitcoin::hashes::ripemd160::Hash
253251 fn to_ripemd160 ( hash : & <Self as MiniscriptKey >:: Ripemd160 ) -> ripemd160:: Hash ;
254252
255- /// Converts the generic associated [`MiniscriptKey::Hash160`] to [`hash160::Hash`]
253+ /// Converts the associated [`MiniscriptKey::Hash160`] type to a [`hash160::Hash`].
254+ ///
255+ /// [`hash160::Hash`]: bitcoin::hashes::hash160::Hash
256256 fn to_hash160 ( hash : & <Self as MiniscriptKey >:: Hash160 ) -> hash160:: Hash ;
257257}
258258
0 commit comments