diff --git a/src/gates.rs b/src/gates.rs index 71c614f..ddd77d5 100644 --- a/src/gates.rs +++ b/src/gates.rs @@ -238,7 +238,11 @@ mod tests { taproot_annex_scriptleaf: Some((TapLeafHash::all_zeros(), None)), }, script.clone(), - solution_preimages.clone().iter().map(|preimage| preimage.to_vec()).collect(), + solution_preimages + .clone() + .iter() + .map(|preimage| preimage.to_vec()) + .collect(), ) .expect("error creating exec") } @@ -256,7 +260,6 @@ mod tests { } fn test_gate(gate_name: &str) { - let wire_0 = Wire::new(0); let wire_1 = Wire::new(1); let wire_2 = Wire::new(2); @@ -302,14 +305,12 @@ mod tests { println!("script: {:?}", script); for input in all_possible_inputs.iter() { - gate.set_input_bits(input.clone()); gate.evaluate(); let gate_res = gate.run_gate_on_inputs(input.clone()); for output in all_possible_outputs.iter() { - gate.set_output_bits(output.clone()); let solution_preimages = gate.create_response_witness(lock_preimage); @@ -333,7 +334,6 @@ mod tests { println!("output preimage indices: {:?}", output_wire_preimages); let has_error = check_exec(exec, compare_vectors); println!("has_error: {}", has_error); - } } } diff --git a/src/traits/gate.rs b/src/traits/gate.rs index 751babf..a383182 100644 --- a/src/traits/gate.rs +++ b/src/traits/gate.rs @@ -1,4 +1,4 @@ -use crate::wire::{HashValue, Wire, PreimageValue}; +use crate::wire::{HashValue, PreimageValue, Wire}; use bitcoin::ScriptBuf; use std::{ iter::zip, diff --git a/src/verifier.rs b/src/verifier.rs index 9da6fa0..b4a15f2 100644 --- a/src/verifier.rs +++ b/src/verifier.rs @@ -442,21 +442,8 @@ async fn handle_connection(stream: TcpStream) { let witness = sighash_cache.witness_mut(0).unwrap(); witness.push(equivocation_sig.as_ref()); - witness.push( - value - .clone() - .preimages - .unwrap() - .one - .unwrap(), - ); - witness.push( - value - .preimages - .unwrap() - .zero - .unwrap(), - ); + witness.push(value.clone().preimages.unwrap().one.unwrap()); + witness.push(value.preimages.unwrap().zero.unwrap()); witness.push(equivocation_script); witness.push(&equivocation_control_block.serialize());