Dry-runs all taproot input scripts. Return Ok(()) if all scripts execute successfully, or Err((input_index, ExecuteInfo)) otherwise
(tx: &Transaction, prevouts: &[TxOut])
| 243 | /// Dry-runs all taproot input scripts. Return Ok(()) if all scripts execute successfully, |
| 244 | /// or Err((input_index, ExecuteInfo)) otherwise |
| 245 | pub fn dry_run_taproots(tx: &Transaction, prevouts: &[TxOut]) -> Result<(), ExecuteInfo> { |
| 246 | let taproot_indices = prevouts |
| 247 | .iter() |
| 248 | .enumerate() |
| 249 | .filter(|(_, prevout)| prevout.script_pubkey.as_script().is_p2tr()) // only taproots |
| 250 | .filter(|(idx, _)| tx.input[*idx].witness.tapscript().is_some()) // only script path spends |
| 251 | .map(|(idx, _)| idx); |
| 252 | |
| 253 | for taproot_index in taproot_indices { |
| 254 | let result = dry_run_taproot_input(tx, taproot_index, prevouts); |
| 255 | if !result.success { |
| 256 | return Err(result); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | Ok(()) |
| 261 | } |
| 262 | |
| 263 | pub fn run(script: treepp::Script) { |
| 264 | // let stack = script.clone().analyze_stack(); |
nothing calls this directly
no test coverage detected