pub fn derive_public_key<C: Verification>(
        &self,
        secp: &Secp256k1<C>,
    ) -> Result<bitcoin::PublicKey, ConversionError> {
        match *self {
            DescriptorPublicKey::Single(ref pk) => match pk.key {
                SinglePubKey::FullKey(pk) => Ok(pk),
                SinglePubKey::XOnly(xpk) => Ok(xpk.to_public_key()),
            },
            DescriptorPublicKey::XPub(ref xpk) => match xpk.wildcard {
                Wildcard::Unhardened => Err(ConversionError::Wildcard),
                Wildcard::Hardened => Err(ConversionError::HardenedWildcard),
                Wildcard::None => match xpk.xkey.derive_pub(secp, &xpk.derivation_path.as_ref()) {
                    Ok(xpub) => Ok(bitcoin::PublicKey::new(xpub.public_key)),
                    Err(bip32::Error::CannotDeriveFromHardenedKey) => {
                        Err(ConversionError::HardenedChild)
                    }
                    Err(e) => unreachable!("cryptographically unreachable: {}", e),
                },
            },
        }
    }
/// Computes the public key corresponding to this descriptor key.
/// When deriving from an XOnlyPublicKey, it adds the default 0x02 y-coordinate
/// and returns the obtained full [`bitcoin::PublicKey`]. All BIP32 derivations
/// always return a compressed key
///
/// Will return an error if the descriptor key has any hardened
/// derivation steps in its path, or if the key has any wildcards.
///
/// To ensure there are no wildcards, call `.derive(0)` or similar;
/// to avoid hardened derivation steps, start from a `DescriptorSecretKey`
/// and call `to_public`, or call `TranslatePk2::translate_pk2` with
/// some function which has access to secret key data.
Computes the public key corresponding to this descriptor key.
When deriving from an XOnlyPublicKey, it adds the default 0x02 y-coordinate
and returns the obtained full [`bitcoin::PublicKey`]. All BIP32 derivations
always return a compressed key

Will return an error if the descriptor key has any hardened
derivation steps in its path, or if the key has any wildcards.


Computes the public key corresponding to this descriptor key . When deriving from an XOnlyPublicKey it adds the default 0x02 y - coordinate and returns the obtained full [ ` bitcoin :: PublicKey ` ] . All BIP32 derivations always return a compressed key Will return an error if the descriptor key has any hardened derivation steps in its path or if the key has any wildcards .
pub fn derive_public_key<C: Verification>(
        &self,
        secp: &Secp256k1<C>,
    ) -> Result<bitcoin::PublicKey, ConversionError> {
        match *self {
            DescriptorPublicKey::Single(ref pk) => match pk.key {
                SinglePubKey::FullKey(pk) => Ok(pk),
                SinglePubKey::XOnly(xpk) => Ok(xpk.to_public_key()),
            },
            DescriptorPublicKey::XPub(ref xpk) => match xpk.wildcard {
                Wildcard::Unhardened => Err(ConversionError::Wildcard),
                Wildcard::Hardened => Err(ConversionError::HardenedWildcard),
                Wildcard::None => match xpk.xkey.derive_pub(secp, &xpk.derivation_path.as_ref()) {
                    Ok(xpub) => Ok(bitcoin::PublicKey::new(xpub.public_key)),
                    Err(bip32::Error::CannotDeriveFromHardenedKey) => {
                        Err(ConversionError::HardenedChild)
                    }
                    Err(e) => unreachable!("cryptographically unreachable: {}", e),
                },
            },
        }
    }
pub fn derive_public_key < C : Verification > ( & self , secp : & Secp256k1 < C > , ) -> Result < bitcoin :: PublicKey , ConversionError > { match * self { DescriptorPublicKey :: Single ( ref pk ) => match pk . key { SinglePubKey :: FullKey ( pk ) => Ok ( pk ) , SinglePubKey :: XOnly ( xpk ) => Ok ( xpk . to_public_key ( ) ) , } , DescriptorPublicKey :: XPub ( ref xpk ) => match xpk . wildcard { Wildcard :: Unhardened => Err ( ConversionError :: Wildcard ) , Wildcard :: Hardened => Err ( ConversionError :: HardenedWildcard ) , Wildcard :: None => match xpk . xkey . derive_pub ( secp , & xpk . derivation_path . as_ref ( ) ) { Ok ( xpub ) => Ok ( bitcoin :: PublicKey :: new ( xpub . public_key ) ) , Err ( bip32 :: Error :: CannotDeriveFromHardenedKey ) => { Err ( ConversionError :: HardenedChild ) } Err ( e ) => unreachable ! ( " " e ) , } , } , } }
Computes the public key corresponding to this descriptor key.
Computes the public key corresponding to this descriptor key .
&self
secp
&Secp256k1<C>
&self
secp
&Secp256k1<C>