Skip to main content

Descriptor

Trait Descriptor 

Source
pub trait Descriptor<Key> {
    // Required methods
    fn check_sanity(&self) -> Result<(), DeriveError>;
    fn derive_pattern_len(&self) -> Result<usize, DeriveError>;
    fn network(&self, regtest: bool) -> Result<Network, DeriveError>;
    fn address<C: Verification>(
        &self,
        secp: &Secp256k1<C>,
        pat: impl AsRef<[UnhardenedIndex]>,
        regtest: bool,
    ) -> Result<AddressCompat, DeriveError>;
    fn script_pubkey_pretr<C: Verification>(
        &self,
        secp: &Secp256k1<C>,
        pat: impl AsRef<[UnhardenedIndex]>,
    ) -> Result<Script, DeriveError>;
    fn script_pubkey_tr<C: Verification>(
        &self,
        secp: &Secp256k1<C>,
        pat: impl AsRef<[UnhardenedIndex]>,
    ) -> Result<Script, DeriveError>;
}
Expand description

Standard methods which should be supported by descriptors of different sorts.

Required Methods§

Source

fn check_sanity(&self) -> Result<(), DeriveError>

Checks sanity of the output descriptor (see DeriveError for the list of possible inconsistencies).

Source

fn derive_pattern_len(&self) -> Result<usize, DeriveError>

Measures length of the derivation wildcard pattern accross all keys participating descriptor

Source

fn network(&self, regtest: bool) -> Result<Network, DeriveError>

Detects bitcoin network which should be used with the provided descriptor

Source

fn address<C: Verification>( &self, secp: &Secp256k1<C>, pat: impl AsRef<[UnhardenedIndex]>, regtest: bool, ) -> Result<AddressCompat, DeriveError>

Generates address from the descriptor for specific derive pattern

Source

fn script_pubkey_pretr<C: Verification>( &self, secp: &Secp256k1<C>, pat: impl AsRef<[UnhardenedIndex]>, ) -> Result<Script, DeriveError>

Creates scriptPubkey for specific derive pattern in pre-taproot descriptors

Source

fn script_pubkey_tr<C: Verification>( &self, secp: &Secp256k1<C>, pat: impl AsRef<[UnhardenedIndex]>, ) -> Result<Script, DeriveError>

Creates scriptPubkey for specific derive pattern in taproot descriptors

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§