Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- impl PartiallySignedTransaction {
- /// Returns a vector the funding utxos of a psbt
- pub fn to_prevouts(&self) -> sighash::Prevouts {
- let mut prev_outs : Vec<&TxOut> = Vec::new();
- for i in 0..self.inputs.len() {
- let psbt_input : Input = self.inputs[i];
- // check for witness utxos
- if let Some(ref witness_utxo) = psbt_input.witness_utxo {
- prev_outs.push(&witness_utxo)
- // if no witness utxos then catch the non witness part of the input
- } else if let Some(ref non_witness_utxo) = psbt_input.non_witness_utxo {
- // get output index (vout) from the outpoint and use it to get the non_witness_utxo
- let vout: usize = self.unsigned_tx.input[i].previous_output.vout;
- prev_outs.push(&non_witness_utxo.output[vout])
- }
- }
- return prev_outs;
- }
- ...
- ... other procedures ...
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement