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>
Expand description

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.

  1. PK: creates a Pk descriptor and translates the scriptsig to a Stack
  2. Pkh: Removes top element(pk) and validates pubkey hash, pushes rest of witness to a Stack and outputs a Pkh descriptor
  3. Wphk: translates witness to a Stack, validates sig and pubkey hash and outputs a Wpkh descriptor
  4. Wsh: pops witness script and checks wsh output hash, translates remaining witness elements to a Stack and outputs a Wsh descriptor. Does not check miniscript inside the descriptor
  5. Bare: translates script_sig to a Stack and script_pubkey to miniscript
  6. Sh: Checks redeem_script hash, translates remaining elements from script_sig to a Stack and redeem script to miniscript. Does not check the miniscript
  7. ShWpkh: Checks redeem_script hash, translates remaining elements from script_sig to a Stack and validates Wpkh sig, pubkey.
  8. ShWsh: Checks witness script hash, pops witness script and converts it to miniscript. translates the remaining witness to a Stack