diff --git a/consensus/src/taproot.rs b/consensus/src/taproot.rs index 26a8fefc..46c25f19 100644 --- a/consensus/src/taproot.rs +++ b/consensus/src/taproot.rs @@ -172,13 +172,7 @@ impl InternalPk { #[inline] pub fn to_byte_array(&self) -> [u8; 32] { self.0.to_byte_array() } - #[deprecated(since = "0.10.9", note = "use to_output_pk")] - pub fn to_output_key(&self, merkle_root: Option) -> XOnlyPublicKey { - let (pk, _) = self.to_output_pk(merkle_root); - pk.0.0 - } - - pub fn to_output_pk(&self, merkle_root: Option) -> (OutputPk, Parity) { + pub fn to_output_pk(&self, merkle_root: Option) -> (OutputPk, Parity) { let mut engine = Sha256::from_tag(MIDSTATE_TAPTWEAK); // always hash the key engine.input_raw(&self.0.serialize()); @@ -672,18 +666,18 @@ impl TapScript { } impl ScriptPubkey { - pub fn p2tr(internal_key: InternalPk, merkle_root: Option) -> Self { + pub fn p2tr(internal_key: InternalPk, merkle_root: Option) -> Self { let (output_key, _) = internal_key.to_output_pk(merkle_root); Self::p2tr_tweaked(output_key) } pub fn p2tr_key_only(internal_key: InternalPk) -> Self { - let (output_key, _) = internal_key.to_output_pk(None::); + let (output_key, _) = internal_key.to_output_pk(None); Self::p2tr_tweaked(output_key) } pub fn p2tr_scripted(internal_key: InternalPk, merkle_root: impl IntoTapHash) -> Self { - let (output_key, _) = internal_key.to_output_pk(Some(merkle_root)); + let (output_key, _) = internal_key.to_output_pk(Some(merkle_root.into_tap_hash())); Self::p2tr_tweaked(output_key) } diff --git a/dbc/src/tapret/xonlypk.rs b/dbc/src/tapret/xonlypk.rs index 7e51fff9..ab8679e2 100644 --- a/dbc/src/tapret/xonlypk.rs +++ b/dbc/src/tapret/xonlypk.rs @@ -94,7 +94,7 @@ impl ConvolveCommit for InternalPk { mod test { use std::str::FromStr; - use bc::LeafScript; + use bc::{IntoTapHash, LeafScript}; use commit_verify::mpc::Commitment; use super::*; @@ -115,7 +115,7 @@ mod test { let tapret_commitment = TapretCommitment::with(msg, path_proof.nonce); let script_commitment = TapScript::commit(&tapret_commitment); let script_leaf = TapLeafHash::with_tap_script(&script_commitment); - let (real_key, _) = internal_pk.to_output_pk(Some(script_leaf)); + let (real_key, _) = internal_pk.to_output_pk(Some(script_leaf.into_tap_hash())); assert_eq!(outer_key, real_key);