Skip to main content

reconstruct_xpub

Function reconstruct_xpub 

Source
pub fn reconstruct_xpub(
    compact: &XpubCompact,
    origin_path: &DerivationPath,
) -> Result<Xpub>
Expand description

Reconstruct a full BIP 32 Xpub from a compact form + the origin path (which provides depth and child_number per Q-7’s reconstruction rule).

Per design/SPEC_mk_v0_1.md §3.6:

depth        := component_count(origin_path)
child_number := last_component(origin_path) (with hardened-bit encoding),
                or Normal{0} when origin_path is empty (depth-0 / no-path key)

An empty origin_path (the no-path / depth-0 case, e.g. a WIF) yields depth = 0 and child_number = Normal{0} (the BIP-32 master convention) — v0.4.0+; earlier versions required a non-empty path.