[−][src]Struct miniscript::descriptor::DescriptorXKey
Instance of an extended key with origin and derivation path
Fields
origin: Option<(Fingerprint, DerivationPath)>
Origin information
xkey: K
The extended key
derivation_path: DerivationPath
The derivation path
is_wildcard: bool
Whether the descriptor is wildcard
Implementations
impl<K: InnerXKey> DescriptorXKey<K>
[src]
pub fn matches<C: Signing>(
&self,
keysource: &KeySource,
secp: &Secp256k1<C>
) -> Option<DerivationPath>
[src]
&self,
keysource: &KeySource,
secp: &Secp256k1<C>
) -> Option<DerivationPath>
Compares this key with a keysource
and returns the matching derivation path, if any.
For keys that have an origin, the keysource
's fingerprint will be compared
with the origin's fingerprint, and the keysource
's path will be compared with the concatenation of the
origin's and key's paths.
If the key is_wildcard
, the last item of the keysource
's path will be ignored,
Examples
use miniscript::bitcoin::util::bip32; use miniscript::descriptor::DescriptorPublicKey; let ctx = miniscript::bitcoin::secp256k1::Secp256k1::signing_only(); let key = DescriptorPublicKey::from_str("[d34db33f/44'/0'/0']xpub6ERApfZwUNrhLCkDtcHTcxd75RbzS1ed54G1LkBUHQVHQKqhMkhgbmJbZRkrgZw4koxb5JaHWkY4ALHY2grBGRjaDMzQLcgJvLJuZZvRcEL/1/*")?; let xpub = match key { DescriptorPublicKey::XPub(xpub) => xpub, _ => panic!("Parsing Error"), }; assert_eq!(xpub.matches(&(bip32::Fingerprint::from_str("d34db33f")?, bip32::DerivationPath::from_str("m/44'/0'/0'/1/42")?), &ctx), Some(bip32::DerivationPath::from_str("m/44'/0'/0'/1")?)); assert_eq!(xpub.matches(&(bip32::Fingerprint::from_str("ffffffff")?, bip32::DerivationPath::from_str("m/44'/0'/0'/1/42")?), &ctx), None); assert_eq!(xpub.matches(&(bip32::Fingerprint::from_str("d34db33f")?, bip32::DerivationPath::from_str("m/44'/0'/0'/100/0")?), &ctx), None);
Trait Implementations
impl<K: Clone + InnerXKey> Clone for DescriptorXKey<K>
[src]
pub fn clone(&self) -> DescriptorXKey<K>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<K: Debug + InnerXKey> Debug for DescriptorXKey<K>
[src]
impl<K: Eq + InnerXKey> Eq for DescriptorXKey<K>
[src]
impl<K: Hash + InnerXKey> Hash for DescriptorXKey<K>
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<K: Ord + InnerXKey> Ord for DescriptorXKey<K>
[src]
pub fn cmp(&self, other: &DescriptorXKey<K>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<K: PartialEq + InnerXKey> PartialEq<DescriptorXKey<K>> for DescriptorXKey<K>
[src]
pub fn eq(&self, other: &DescriptorXKey<K>) -> bool
[src]
pub fn ne(&self, other: &DescriptorXKey<K>) -> bool
[src]
impl<K: PartialOrd + InnerXKey> PartialOrd<DescriptorXKey<K>> for DescriptorXKey<K>
[src]
pub fn partial_cmp(&self, other: &DescriptorXKey<K>) -> Option<Ordering>
[src]
pub fn lt(&self, other: &DescriptorXKey<K>) -> bool
[src]
pub fn le(&self, other: &DescriptorXKey<K>) -> bool
[src]
pub fn gt(&self, other: &DescriptorXKey<K>) -> bool
[src]
pub fn ge(&self, other: &DescriptorXKey<K>) -> bool
[src]
impl<K: InnerXKey> StructuralEq for DescriptorXKey<K>
[src]
impl<K: InnerXKey> StructuralPartialEq for DescriptorXKey<K>
[src]
Auto Trait Implementations
impl<K> RefUnwindSafe for DescriptorXKey<K> where
K: RefUnwindSafe,
K: RefUnwindSafe,
impl<K> Send for DescriptorXKey<K> where
K: Send,
K: Send,
impl<K> Sync for DescriptorXKey<K> where
K: Sync,
K: Sync,
impl<K> Unpin for DescriptorXKey<K> where
K: Unpin,
K: Unpin,
impl<K> UnwindSafe for DescriptorXKey<K> where
K: UnwindSafe,
K: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,