@@ -28,7 +28,9 @@ use crate::crypto::{ecdsa, taproot};
28
28
use crate :: key:: { TapTweak , XOnlyPublicKey } ;
29
29
use crate :: prelude:: * ;
30
30
use crate :: sighash:: { self , EcdsaSighashType , Prevouts , SighashCache } ;
31
- use crate :: { Amount , FeeRate , TapLeafHash , TapSighashType } ;
31
+ use crate :: { Amount , FeeRate , TapLeafHash , TapSighash , TapSighashType } ;
32
+
33
+ use crate :: hashes:: Hash ;
32
34
33
35
#[ rustfmt:: skip] // Keep public re-exports separate.
34
36
#[ doc( inline) ]
@@ -444,6 +446,8 @@ impl Psbt {
444
446
. tap_tweak ( secp, input. tap_merkle_root )
445
447
. to_inner ( ) ;
446
448
449
+ let msg = msg. to_byte_array ( ) ;
450
+
447
451
#[ cfg( feature = "rand-std" ) ]
448
452
let signature = secp. sign_schnorr ( & msg, & key_pair) ;
449
453
#[ cfg( not( feature = "rand-std" ) ) ]
@@ -471,6 +475,8 @@ impl Psbt {
471
475
let ( msg, sighash_type) =
472
476
self . sighash_taproot ( input_index, cache, Some ( lh) ) ?;
473
477
478
+ let msg = msg. to_byte_array ( ) ;
479
+
474
480
#[ cfg( feature = "rand-std" ) ]
475
481
let signature = secp. sign_schnorr ( & msg, & key_pair) ;
476
482
#[ cfg( not( feature = "rand-std" ) ) ]
@@ -561,7 +567,7 @@ impl Psbt {
561
567
input_index : usize ,
562
568
cache : & mut SighashCache < T > ,
563
569
leaf_hash : Option < TapLeafHash > ,
564
- ) -> Result < ( Message , TapSighashType ) , SignError > {
570
+ ) -> Result < ( TapSighash , TapSighashType ) , SignError > {
565
571
use OutputType :: * ;
566
572
567
573
if self . signing_algorithm ( input_index) ? != SigningAlgorithm :: Schnorr {
@@ -606,7 +612,7 @@ impl Psbt {
606
612
} else {
607
613
cache. taproot_key_spend_signature_hash ( input_index, & prev_outs, hash_ty) ?
608
614
} ;
609
- Ok ( ( Message :: from ( sighash) , hash_ty) )
615
+ Ok ( ( sighash, hash_ty) )
610
616
}
611
617
_ => Err ( SignError :: Unsupported ) ,
612
618
}
0 commit comments