pub struct Descriptor {
pub n: u8,
pub path_decl: PathDecl,
pub use_site_path: UseSitePath,
pub tree: Node,
pub tlv: TlvSection,
}Expand description
Top-level descriptor parsed/built from a v0.30 wire payload.
Each field corresponds to a spec section: Header (§3.2), origin
PathDecl (§3.3), use-site UseSitePath (§3.4), descriptor tree
(§3.5–3.6), and trailing tlv section (§3.7).
Fields§
§n: u8Number of placeholders (1-indexed key universe size).
path_decl: PathDeclOrigin path declaration (single or per-@N divergent).
use_site_path: UseSitePathUse-site (post-key) path applied to every key by default.
tree: NodeDescriptor tree root node.
tlv: TlvSectionTrailing TLV section (overrides, fingerprints, etc.).
Implementations§
Source§impl Descriptor
impl Descriptor
Sourcepub fn derive_address(
&self,
chain: u32,
index: u32,
network: Network,
) -> Result<Address<NetworkUnchecked>, Error>
pub fn derive_address( &self, chain: u32, index: u32, network: Network, ) -> Result<Address<NetworkUnchecked>, Error>
Derive the address at (chain, index) for this descriptor on
network.
chain selects the use-site multipath alternative (e.g. 0 =
receive, 1 = change for the standard <0;1>/* form). index is
the trailing wildcard child number.
Returns an Address<NetworkUnchecked>; callers can
.assume_checked() (when they trust the network parameter) or
.require_network(network) to lock it down.
§Errors
Error::MissingPubkeywhen any@Nlacks an xpub.Error::InvalidXpubByteswhen an xpub’s 33-byte pubkey field doesn’t parse as a valid secp256k1 point.Error::ChainIndexOutOfRangewhenchainis out of range for the use-site multipath.Error::HardenedPublicDerivationwhen the use-site path requires a hardened derivation step.Error::MissingExplicitOriginpropagated fromcrate::canonicalize::expand_per_at_n.Error::AddressDerivationFailedfor any miniscript-layer failure (type check, context error, unsupported fragment).
Source§impl Descriptor
impl Descriptor
Sourcepub fn key_index_width(&self) -> u8
pub fn key_index_width(&self) -> u8
Bit width for placeholder-index encoding: ⌈log₂(n)⌉ per SPEC v0.30 §7.
Index range is 0..n. The NUMS H-point is signalled by an explicit
is_nums bit on Body::Tr (SPEC §7), not by a reserved sentinel.
MUST stay in lockstep with decode::decode_payload’s independent
computation; a stale formula would silently desync the bitstream.
Sourcepub fn is_wallet_policy(&self) -> bool
pub fn is_wallet_policy(&self) -> bool
Returns true iff this descriptor is in wallet-policy mode per
SPEC §3.3: the Pubkeys TLV is present and contains at least one
entry. Template-only mode (no Pubkeys TLV at all, or Pubkeys = Some(vec![]) after sparse-decode) returns false.
The check is a post-TLV-decode predicate; mode dispatch never reads a header bit.
Trait Implementations§
Source§impl Clone for Descriptor
impl Clone for Descriptor
Source§fn clone(&self) -> Descriptor
fn clone(&self) -> Descriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Descriptor
impl Debug for Descriptor
Source§impl PartialEq for Descriptor
impl PartialEq for Descriptor
Source§fn eq(&self, other: &Descriptor) -> bool
fn eq(&self, other: &Descriptor) -> bool
self and other values to be equal, and is used by ==.