File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -322,12 +322,8 @@ impl PublicKey {
322322 secp : & Secp256k1 < V > ,
323323 tweaked_key : & Self ,
324324 tweaked_parity : bool ,
325- tweak : & [ u8 ] ,
326- ) -> Result < ( ) , Error > {
327- if tweak. len ( ) != 32 {
328- return Err ( Error :: InvalidTweak ) ;
329- }
330-
325+ tweak : [ u8 ; 32 ] ,
326+ ) -> bool {
331327 let tweaked_ser = tweaked_key. serialize ( ) ;
332328 unsafe {
333329 let err = ffi:: secp256k1_xonly_pubkey_tweak_add_check (
@@ -338,11 +334,7 @@ impl PublicKey {
338334 tweak. as_c_ptr ( ) ,
339335 ) ;
340336
341- if err == 1 {
342- Ok ( ( ) )
343- } else {
344- Err ( Error :: TweakCheckFailed )
345- }
337+ err == 1
346338 }
347339 }
348340}
@@ -766,7 +758,7 @@ mod tests {
766758 kp. tweak_add_assign ( & s, & tweak) . expect ( "Tweak error" ) ;
767759 let parity = pk. tweak_add_assign ( & s, & tweak) . expect ( "Tweak error" ) ;
768760 assert_eq ! ( PublicKey :: from_keypair( & s, & kp) , pk) ;
769- orig_pk. tweak_add_check ( & s, & pk, parity, & tweak) . expect ( "tweak check" ) ;
761+ assert ! ( orig_pk. tweak_add_check( & s, & pk, parity, tweak) ) ;
770762 }
771763 }
772764
You can’t perform that action at this time.
0 commit comments