[−][src]Function miniscript::descriptor::from_txin_with_witness_stack
pub fn from_txin_with_witness_stack<'txin>(
script_pubkey: &Script,
script_sig: &'txin Script,
witness: &'txin [Vec<u8>]
) -> Result<(Descriptor<PublicKey>, Stack<'txin>), Error>
Figures out the the type of descriptor based on scriptpubkey, witness and scriptsig.
Outputs a Descriptor
and Stack
which can be directly fed into the
interpreter. All script_sig and witness are translated into a single witness stack.
PK
: creates aPk
descriptor and translates the scriptsig to aStack
Pkh
: Removes top element(pk) and validates pubkey hash, pushes rest of witness to aStack
and outputs aPkh
descriptorWphk
: translates witness to aStack
, validates sig and pubkey hash and outputs aWpkh
descriptorWsh
: pops witness script and checks wsh output hash, translates remaining witness elements to aStack
and outputs aWsh
descriptor. Does not check miniscript inside the descriptorBare
: translates script_sig to aStack
and script_pubkey to miniscriptSh
: Checks redeem_script hash, translates remaining elements from script_sig to aStack
and redeem script to miniscript. Does not check the miniscriptShWpkh
: Checks redeem_script hash, translates remaining elements from script_sig to aStack
and validatesWpkh
sig, pubkey.ShWsh
: Checks witness script hash, pops witness script and converts it to miniscript. translates the remaining witness to aStack