File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -246,6 +246,25 @@ impl MiniscriptKey for DescriptorPublicKey {
246
246
}
247
247
}
248
248
249
+ impl ToPublicKey for DescriptorPublicKey {
250
+ fn to_public_key ( & self ) -> bitcoin:: PublicKey {
251
+ match * self {
252
+ DescriptorPublicKey :: PukKey ( ref pk) => * pk,
253
+ DescriptorPublicKey :: XPub ( ref xpub) => {
254
+ let ctx = secp256k1:: Secp256k1 :: verification_only ( ) ;
255
+ xpub. xpub
256
+ . derive_pub ( & ctx, & xpub. derivation_path )
257
+ . expect ( "Shouldn't fail, only normal derivations" )
258
+ . public_key
259
+ }
260
+ }
261
+ }
262
+
263
+ fn hash_to_hash160 ( hash : & Self :: Hash ) -> hash160:: Hash {
264
+ * hash
265
+ }
266
+ }
267
+
249
268
impl < Pk : MiniscriptKey > Descriptor < Pk > {
250
269
/// Convert a descriptor using abstract keys to one using specific keys
251
270
/// This will panic if translatefpk returns an uncompressed key when
You can’t perform that action at this time.
0 commit comments