File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -59,26 +59,22 @@ where
5959}
6060
6161/// Tweaks a bare key using the scriptPubKey of a descriptor
62- pub fn tweak_private_key < ' a , Pk , V > (
62+ pub fn tweak_private_key < V > (
6363 secp : & secp256k1_zkp:: Secp256k1 < V > ,
6464 spk : & elements:: Script ,
65- pk : & Pk ,
66- ) -> secp256k1_zkp:: PublicKey
65+ sk : & secp256k1_zkp :: SecretKey ,
66+ ) -> secp256k1_zkp:: SecretKey
6767where
68- Pk : ToPublicKey + ' a ,
69- V : secp256k1_zkp:: Verification ,
68+ V : secp256k1_zkp:: Signing ,
7069{
7170 let mut eng = TweakHash :: engine ( ) ;
72- pk . to_public_key ( )
71+ bitcoin :: PublicKey :: new ( sk . public_key ( secp ) )
7372 . write_into ( & mut eng)
7473 . expect ( "engines don't error" ) ;
7574 spk. consensus_encode ( & mut eng) . expect ( "engines don't error" ) ;
7675 let hash_bytes = TweakHash :: from_engine ( eng) . to_byte_array ( ) ;
7776 let hash_scalar = secp256k1_zkp:: Scalar :: from_be_bytes ( hash_bytes) . expect ( "bytes from hash" ) ;
78- pk. to_public_key ( )
79- . inner
80- . add_exp_tweak ( secp, & hash_scalar)
81- . unwrap ( )
77+ sk. add_tweak ( & hash_scalar) . unwrap ( )
8278}
8379
8480#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments