File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -245,18 +245,27 @@ impl MiniscriptKey for DescriptorPublicKey {
245
245
type Hash = hash160:: Hash ;
246
246
247
247
fn to_pubkeyhash ( & self ) -> Self :: Hash {
248
+ self . to_public_key ( ) . to_pubkeyhash ( )
249
+ }
250
+ }
251
+
252
+ impl ToPublicKey for DescriptorPublicKey {
253
+ fn to_public_key ( & self ) -> bitcoin:: PublicKey {
248
254
match * self {
249
- DescriptorPublicKey :: PubKey ( ref pk) => pk . to_pubkeyhash ( ) ,
255
+ DescriptorPublicKey :: PubKey ( ref pk) => * pk ,
250
256
DescriptorPublicKey :: XPub ( ref xpub) => {
251
257
let ctx = secp256k1:: Secp256k1 :: verification_only ( ) ;
252
258
xpub. xpub
253
259
. derive_pub ( & ctx, & xpub. derivation_path )
254
- . expect ( "Won 't fail, only normal derivations" )
260
+ . expect ( "Shouldn 't fail, only normal derivations" )
255
261
. public_key
256
- . to_pubkeyhash ( )
257
262
}
258
263
}
259
264
}
265
+
266
+ fn hash_to_hash160 ( hash : & Self :: Hash ) -> hash160:: Hash {
267
+ * hash
268
+ }
260
269
}
261
270
262
271
impl < Pk : MiniscriptKey > Descriptor < Pk > {
You can’t perform that action at this time.
0 commit comments