pub fn script_pubkey(&self) -> Script {
        match *self {
            Descriptor::Bare(ref d) => d.encode(),
            Descriptor::Pk(ref pk) => script::Builder::new()
                .push_key(&pk.to_public_key())
                .push_opcode(opcodes::all::OP_CHECKSIG)
                .into_script(),
            Descriptor::Pkh(ref pk) => {
                let addr =
                    elements::Address::p2pkh(&pk.to_public_key(), None, &AddressParams::ELEMENTS);
                addr.script_pubkey()
            }
            Descriptor::Wpkh(ref pk) => {
                let addr =
                    elements::Address::p2wpkh(&pk.to_public_key(), None, &AddressParams::ELEMENTS);
                addr.script_pubkey()
            }
            Descriptor::ShWpkh(ref pk) => {
                let addr = elements::Address::p2shwpkh(
                    &pk.to_public_key(),
                    None,
                    &AddressParams::ELEMENTS,
                );
                addr.script_pubkey()
            }
            Descriptor::Sh(ref miniscript) => miniscript.encode().to_p2sh(),
            Descriptor::Wsh(ref miniscript) => miniscript.encode().to_v0_p2wsh(),
            Descriptor::ShWsh(ref miniscript) => miniscript.encode().to_v0_p2wsh().to_p2sh(),
            Descriptor::Cov(ref cov) => cov.commit_ctx.script_pubkey().to_v0_p2wsh(),
        }
    }
/// Computes the scriptpubkey of the descriptor
Computes the scriptpubkey of the descriptor
Computes the scriptpubkey of the descriptor
pub fn script_pubkey(&self) -> Script {
        match *self {
            Descriptor::Bare(ref d) => d.encode(),
            Descriptor::Pk(ref pk) => script::Builder::new()
                .push_key(&pk.to_public_key())
                .push_opcode(opcodes::all::OP_CHECKSIG)
                .into_script(),
            Descriptor::Pkh(ref pk) => {
                let addr =
                    elements::Address::p2pkh(&pk.to_public_key(), None, &AddressParams::ELEMENTS);
                addr.script_pubkey()
            }
            Descriptor::Wpkh(ref pk) => {
                let addr =
                    elements::Address::p2wpkh(&pk.to_public_key(), None, &AddressParams::ELEMENTS);
                addr.script_pubkey()
            }
            Descriptor::ShWpkh(ref pk) => {
                let addr = elements::Address::p2shwpkh(
                    &pk.to_public_key(),
                    None,
                    &AddressParams::ELEMENTS,
                );
                addr.script_pubkey()
            }
            Descriptor::Sh(ref miniscript) => miniscript.encode().to_p2sh(),
            Descriptor::Wsh(ref miniscript) => miniscript.encode().to_v0_p2wsh(),
            Descriptor::ShWsh(ref miniscript) => miniscript.encode().to_v0_p2wsh().to_p2sh(),
            Descriptor::Cov(ref cov) => cov.commit_ctx.script_pubkey().to_v0_p2wsh(),
        }
    }
pub fn script_pubkey ( & self ) -> Script { match * self { Descriptor :: Bare ( ref d ) => d . encode ( ) , Descriptor :: Pk ( ref pk ) => script :: Builder :: new ( ) . push_key ( & pk . to_public_key ( ) ) . push_opcode ( opcodes :: all :: OP_CHECKSIG ) . into_script ( ) , Descriptor :: Pkh ( ref pk ) => { let addr = elements :: Address :: p2pkh ( & pk . to_public_key ( ) , None , & AddressParams :: ELEMENTS ) ; addr . script_pubkey ( ) } Descriptor :: Wpkh ( ref pk ) => { let addr = elements :: Address :: p2wpkh ( & pk . to_public_key ( ) , None , & AddressParams :: ELEMENTS ) ; addr . script_pubkey ( ) } Descriptor :: ShWpkh ( ref pk ) => { let addr = elements :: Address :: p2shwpkh ( & pk . to_public_key ( ) , None , & AddressParams :: ELEMENTS , ) ; addr . script_pubkey ( ) } Descriptor :: Sh ( ref miniscript ) => miniscript . encode ( ) . to_p2sh ( ) , Descriptor :: Wsh ( ref miniscript ) => miniscript . encode ( ) . to_v0_p2wsh ( ) , Descriptor :: ShWsh ( ref miniscript ) => miniscript . encode ( ) . to_v0_p2wsh ( ) . to_p2sh ( ) , Descriptor :: Cov ( ref cov ) => cov . commit_ctx . script_pubkey ( ) . to_v0_p2wsh ( ) , } }
Computes the scriptpubkey of the descriptor
Computes the scriptpubkey of the descriptor
&self
&self