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 {
322
322
secp : & Secp256k1 < V > ,
323
323
tweaked_key : & Self ,
324
324
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 {
331
327
let tweaked_ser = tweaked_key. serialize ( ) ;
332
328
unsafe {
333
329
let err = ffi:: secp256k1_xonly_pubkey_tweak_add_check (
@@ -338,11 +334,7 @@ impl PublicKey {
338
334
tweak. as_c_ptr ( ) ,
339
335
) ;
340
336
341
- if err == 1 {
342
- Ok ( ( ) )
343
- } else {
344
- Err ( Error :: TweakCheckFailed )
345
- }
337
+ err == 1
346
338
}
347
339
}
348
340
}
@@ -766,7 +758,7 @@ mod tests {
766
758
kp. tweak_add_assign ( & s, & tweak) . expect ( "Tweak error" ) ;
767
759
let parity = pk. tweak_add_assign ( & s, & tweak) . expect ( "Tweak error" ) ;
768
760
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) ) ;
770
762
}
771
763
}
772
764
You can’t perform that action at this time.
0 commit comments