You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Earlier we introduced DerivedDescriptorKey (an descriptor whose
wildcards are known to have been replaced with derivation indexes) to
eliminate wildcard derivation errors. This commit attempts to realise the
full benefits of this idea. I tried to keep backwards compatibility.
The naming of things no longer follows the logic of code so I'm going to
fix that in a follow up.
.expect("BIP 32 key index substitution cannot fail")
540
540
}
541
541
542
-
/// Derive a [`Descriptor`] with a concrete [`bitcoin::PublicKey`] at a given index
543
-
/// Removes all extended pubkeys and wildcards from the descriptor and only leaves
544
-
/// concrete [`bitcoin::PublicKey`]. All [`bitcoin::XOnlyPublicKey`]s are converted
545
-
/// to [`bitcoin::PublicKey`]s by adding a default(0x02) y-coordinate. For [`Tr`]
546
-
/// descriptor, spend info is also cached.
542
+
/// Convert all the public keys in the descriptor to [`bitcoin::PublicKey`] by deriving them or
543
+
/// otherwise converting them. All [`bitcoin::XOnlyPublicKey`]s are converted to by adding a
544
+
/// default(0x02) y-coordinate.
547
545
///
548
-
/// # Examples
546
+
/// This is a shorthand for:
549
547
///
550
548
/// ```
551
-
/// use miniscript::descriptor::{Descriptor, DescriptorPublicKey};
552
-
/// use miniscript::bitcoin::secp256k1;
553
-
/// use std::str::FromStr;
554
-
///
555
-
/// // test from bip 86
556
-
/// let secp = secp256k1::Secp256k1::verification_only();
557
-
/// let descriptor = Descriptor::<DescriptorPublicKey>::from_str("tr(xpub6BgBgsespWvERF3LHQu6CnqdvfEvtMcQjYrcRzx53QJjSxarj2afYWcLteoGVky7D3UKDP9QyrLprQ3VCECoY49yfdDEHGCtMMj92pReUsQ/0/*)")
549
+
/// # use miniscript::{Descriptor, DescriptorPublicKey, bitcoin::secp256k1::Secp256k1};
550
+
/// # use core::str::FromStr;
551
+
/// # let descriptor = Descriptor::<DescriptorPublicKey>::from_str("tr(xpub6BgBgsespWvERF3LHQu6CnqdvfEvtMcQjYrcRzx53QJjSxarj2afYWcLteoGVky7D3UKDP9QyrLprQ3VCECoY49yfdDEHGCtMMj92pReUsQ/0/*)")
558
552
/// .expect("Valid ranged descriptor");
559
-
/// let result = descriptor.derived_descriptor(&secp, 0).expect("Non-hardened derivation");
/// Convert all the public keys in the descriptor to [`bitcoin::PublicKey`] by deriving them or
729
+
/// otherwise converting them. All [`bitcoin::XOnlyPublicKey`]s are converted to by adding a
730
+
/// default(0x02) y-coordinate.
731
+
///
732
+
/// # Examples
733
+
///
734
+
/// ```
735
+
/// use miniscript::descriptor::{Descriptor, DescriptorPublicKey};
736
+
/// use miniscript::bitcoin::secp256k1;
737
+
/// use std::str::FromStr;
738
+
///
739
+
/// // test from bip 86
740
+
/// let secp = secp256k1::Secp256k1::verification_only();
741
+
/// let descriptor = Descriptor::<DescriptorPublicKey>::from_str("tr(xpub6BgBgsespWvERF3LHQu6CnqdvfEvtMcQjYrcRzx53QJjSxarj2afYWcLteoGVky7D3UKDP9QyrLprQ3VCECoY49yfdDEHGCtMMj92pReUsQ/0/*)")
742
+
/// .expect("Valid ranged descriptor");
743
+
/// let result = descriptor.derive(0).derived_descriptor(&secp).expect("Non-hardened derivation");
0 commit comments