| 187 | } |
| 188 | |
| 189 | pub fn add_input_output( |
| 190 | &mut self, |
| 191 | connector_c: &ConnectorC, |
| 192 | input_script_index: usize, |
| 193 | input_script_witness: RawWitness, |
| 194 | output_script_pubkey: ScriptBuf, |
| 195 | ) { |
| 196 | // Add output |
| 197 | let output_index = 1; |
| 198 | self.tx.output[output_index].script_pubkey = output_script_pubkey; |
| 199 | |
| 200 | let input_index = 1; |
| 201 | |
| 202 | // Push the unlocking witness |
| 203 | input_script_witness |
| 204 | .into_iter() |
| 205 | .for_each(|x| self.tx.input[input_index].witness.push(x)); |
| 206 | |
| 207 | // Push script + control block |
| 208 | let (script, control_block) = |
| 209 | connector_c.taproot_script_and_control_block(input_script_index); |
| 210 | push_taproot_leaf_script_and_cached_control_block_to_witness( |
| 211 | &mut self.tx, |
| 212 | input_index, |
| 213 | &control_block, |
| 214 | &script, |
| 215 | ); |
| 216 | } |
| 217 | |
| 218 | pub fn merge(&mut self, disprove: &DisproveTransaction) { |
| 219 | merge_transactions(&mut self.tx, &disprove.tx); |