diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index 839a7c29..4e3151cd 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -469,9 +469,9 @@ impl Script { /// the current script, assuming that the script is a Tapscript. #[inline] pub fn to_v1_p2tr(&self, secp: &Secp256k1, internal_key: UntweakedPublicKey) -> Script { - let leaf_hash = TapLeafHash::from_script(&self, LeafVersion::TapScript); + let leaf_hash = TapLeafHash::from_script(self, LeafVersion::TapScript); let merkle_root = TapBranchHash::from_inner(leaf_hash.into_inner()); - Script::new_v1_p2tr(&secp, internal_key, Some(merkle_root)) + Script::new_v1_p2tr(secp, internal_key, Some(merkle_root)) } /// Returns witness version of the script, if any, assuming the script is a `scriptPubkey`. diff --git a/src/blockdata/witness.rs b/src/blockdata/witness.rs index 095b1ce5..41582654 100644 --- a/src/blockdata/witness.rs +++ b/src/blockdata/witness.rs @@ -218,7 +218,7 @@ impl Witness { pub fn push_bitcoin_signature(&mut self, signature: &ecdsa::SerializedSignature, hash_type: EcdsaSighashType) { // Note that a maximal length ECDSA signature is 72 bytes, plus the sighash type makes 73 let mut sig = [0; 73]; - sig[..signature.len()].copy_from_slice(&signature); + sig[..signature.len()].copy_from_slice(signature); sig[signature.len()] = hash_type as u8; self.push(&sig[..signature.len() + 1]); } diff --git a/src/util/psbt/serialize.rs b/src/util/psbt/serialize.rs index 325aeb1f..644afe02 100644 --- a/src/util/psbt/serialize.rs +++ b/src/util/psbt/serialize.rs @@ -125,7 +125,7 @@ impl Deserialize for EcdsaSig { // also has a field sighash_u32 (See BIP141). For example, when signing with non-standard // 0x05, the sighash message would have the last field as 0x05u32 while, the verification // would use check the signature assuming sighash_u32 as `0x01`. - EcdsaSig::from_slice(&bytes) + EcdsaSig::from_slice(bytes) .map_err(|e| match e { EcdsaSigError::EmptySignature => { encode::Error::ParseFailed("Empty partial signature data") @@ -145,7 +145,7 @@ impl Deserialize for EcdsaSig { impl Serialize for KeySource { fn serialize(&self) -> Vec { - let mut rv: Vec = Vec::with_capacity(key_source_len(&self)); + let mut rv: Vec = Vec::with_capacity(key_source_len(self)); rv.append(&mut self.0.to_bytes().to_vec()); @@ -207,7 +207,7 @@ impl Deserialize for PsbtSighashType { // Taproot related ser/deser impl Serialize for XOnlyPublicKey { fn serialize(&self) -> Vec { - XOnlyPublicKey::serialize(&self).to_vec() + XOnlyPublicKey::serialize(self).to_vec() } } @@ -226,7 +226,7 @@ impl Serialize for schnorr::SchnorrSig { impl Deserialize for schnorr::SchnorrSig { fn deserialize(bytes: &[u8]) -> Result { - schnorr::SchnorrSig::from_slice(&bytes) + schnorr::SchnorrSig::from_slice(bytes) .map_err(|e| match e { schnorr::SchnorrSigError::InvalidSighashType(flag) => { encode::Error::from(psbt::Error::NonStandardSighashType(flag as u32)) @@ -264,7 +264,7 @@ impl Deserialize for (XOnlyPublicKey, TapLeafHash) { impl Serialize for ControlBlock { fn serialize(&self) -> Vec { - ControlBlock::serialize(&self) + ControlBlock::serialize(self) } } @@ -311,7 +311,7 @@ impl Serialize for (Vec, KeySource) { impl Deserialize for (Vec, KeySource) { fn deserialize(bytes: &[u8]) -> Result { - let (leafhash_vec, consumed) = deserialize_partial::>(&bytes)?; + let (leafhash_vec, consumed) = deserialize_partial::>(bytes)?; let key_source = KeySource::deserialize(&bytes[consumed..])?; Ok((leafhash_vec, key_source)) } diff --git a/src/util/schnorr.rs b/src/util/schnorr.rs index 8d679120..8a5fa16a 100644 --- a/src/util/schnorr.rs +++ b/src/util/schnorr.rs @@ -110,9 +110,9 @@ impl TapTweak for UntweakedPublicKey { fn tap_tweak(self, secp: &Secp256k1, merkle_root: Option) -> (TweakedPublicKey, secp256k1::Parity) { let tweak_value = TapTweakHash::from_key_and_tweak(self, merkle_root).into_inner(); let mut output_key = self.clone(); - let parity = output_key.tweak_add_assign(&secp, &tweak_value).expect("Tap tweak failed"); + let parity = output_key.tweak_add_assign(secp, &tweak_value).expect("Tap tweak failed"); - debug_assert!(self.tweak_add_check(&secp, &output_key, parity, tweak_value)); + debug_assert!(self.tweak_add_check(secp, &output_key, parity, tweak_value)); (TweakedPublicKey(output_key), parity) } @@ -140,7 +140,7 @@ impl TapTweak for UntweakedKeyPair { fn tap_tweak(mut self, secp: &Secp256k1, merkle_root: Option) -> TweakedKeyPair { let pubkey = crate::XOnlyPublicKey::from_keypair(&self); let tweak_value = TapTweakHash::from_key_and_tweak(pubkey, merkle_root).into_inner(); - self.tweak_add_assign(&secp, &tweak_value).expect("Tap tweak failed"); + self.tweak_add_assign(secp, &tweak_value).expect("Tap tweak failed"); TweakedKeyPair(self) } diff --git a/src/util/taproot.rs b/src/util/taproot.rs index b352f92e..3e7a02c7 100644 --- a/src/util/taproot.rs +++ b/src/util/taproot.rs @@ -802,7 +802,7 @@ impl ControlBlock { ) -> bool { // compute the script hash // Initially the curr_hash is the leaf hash - let leaf_hash = TapLeafHash::from_script(&script, self.leaf_version); + let leaf_hash = TapLeafHash::from_script(script, self.leaf_version); let mut curr_hash = TapBranchHash::from_inner(leaf_hash.into_inner()); // Verify the proof for elem in self.merkle_branch.as_inner() {