@@ -218,7 +218,7 @@ impl<'txin> Interpreter<'txin> {
218218 KeySigPair :: Ecdsa ( key, ecdsa_sig) => {
219219 let script_pubkey = self . script_code . as_ref ( ) . expect ( "Legacy have script code" ) ;
220220 let msg = if self . is_legacy ( ) {
221- let sighash_u32 = ecdsa_sig. hash_ty . to_u32 ( ) ;
221+ let sighash_u32 = ecdsa_sig. sighash_type . to_u32 ( ) ;
222222 let sighash =
223223 cache. legacy_signature_hash ( input_idx, script_pubkey, sighash_u32) ;
224224 sighash. map ( |hash| secp256k1:: Message :: from_digest ( hash. to_byte_array ( ) ) )
@@ -227,11 +227,12 @@ impl<'txin> Interpreter<'txin> {
227227 Some ( txout) => txout. borrow ( ) . value ,
228228 None => return false ,
229229 } ;
230- let sighash = cache. segwit_signature_hash (
230+ // TODO: Don't manually handle the script code.
231+ let sighash = cache. p2wsh_signature_hash (
231232 input_idx,
232233 script_pubkey,
233234 amt,
234- ecdsa_sig. hash_ty ,
235+ ecdsa_sig. sighash_type ,
235236 ) ;
236237 sighash. map ( |hash| secp256k1:: Message :: from_digest ( hash. to_byte_array ( ) ) )
237238 } else {
@@ -240,12 +241,12 @@ impl<'txin> Interpreter<'txin> {
240241 } ;
241242
242243 let success =
243- msg. map ( |msg| secp. verify_ecdsa ( & msg, & ecdsa_sig. sig , & key. inner ) . is_ok ( ) ) ;
244+ msg. map ( |msg| secp. verify_ecdsa ( & msg, & ecdsa_sig. signature , & key. inner ) . is_ok ( ) ) ;
244245 success. unwrap_or ( false ) // unwrap_or checks for errors, while success would have checksig results
245246 }
246247 KeySigPair :: Schnorr ( xpk, schnorr_sig) => {
247248 let sighash_msg = if self . is_taproot_v1_key_spend ( ) {
248- cache. taproot_key_spend_signature_hash ( input_idx, prevouts, schnorr_sig. hash_ty )
249+ cache. taproot_key_spend_signature_hash ( input_idx, prevouts, schnorr_sig. sighash_type )
249250 } else if self . is_taproot_v1_script_spend ( ) {
250251 let tap_script = self . script_code . as_ref ( ) . expect (
251252 "Internal Hack: Saving leaf script instead\
@@ -259,7 +260,7 @@ impl<'txin> Interpreter<'txin> {
259260 input_idx,
260261 prevouts,
261262 leaf_hash,
262- schnorr_sig. hash_ty ,
263+ schnorr_sig. sighash_type ,
263264 )
264265 } else {
265266 // schnorr sigs in ecdsa descriptors
@@ -268,7 +269,7 @@ impl<'txin> Interpreter<'txin> {
268269 let msg =
269270 sighash_msg. map ( |hash| secp256k1:: Message :: from_digest ( hash. to_byte_array ( ) ) ) ;
270271 let success =
271- msg. map ( |msg| secp. verify_schnorr ( & schnorr_sig. sig , & msg, xpk) . is_ok ( ) ) ;
272+ msg. map ( |msg| secp. verify_schnorr ( & schnorr_sig. signature , & msg, xpk) . is_ok ( ) ) ;
272273 success. unwrap_or ( false ) // unwrap_or_default checks for errors, while success would have checksig results
273274 }
274275 }
@@ -1069,12 +1070,12 @@ mod tests {
10691070 inner : secp256k1:: PublicKey :: from_secret_key ( & secp, & sk) ,
10701071 compressed : true ,
10711072 } ;
1072- let sig = secp. sign_ecdsa ( & msg, & sk) ;
1073+ let signature = secp. sign_ecdsa ( & msg, & sk) ;
10731074 ecdsa_sigs. push ( bitcoin:: ecdsa:: Signature {
1074- sig ,
1075- hash_ty : bitcoin:: sighash:: EcdsaSighashType :: All ,
1075+ signature ,
1076+ sighash_type : bitcoin:: sighash:: EcdsaSighashType :: All ,
10761077 } ) ;
1077- let mut sigser = sig . serialize_der ( ) . to_vec ( ) ;
1078+ let mut sigser = signature . serialize_der ( ) . to_vec ( ) ;
10781079 sigser. push ( 0x01 ) ; // sighash_all
10791080 pks. push ( pk) ;
10801081 der_sigs. push ( sigser) ;
@@ -1084,8 +1085,8 @@ mod tests {
10841085 x_only_pks. push ( x_only_pk) ;
10851086 let schnorr_sig = secp. sign_schnorr_with_aux_rand ( & msg, & keypair, & [ 0u8 ; 32 ] ) ;
10861087 let schnorr_sig = bitcoin:: taproot:: Signature {
1087- sig : schnorr_sig,
1088- hash_ty : bitcoin:: sighash:: TapSighashType :: Default ,
1088+ signature : schnorr_sig,
1089+ sighash_type : bitcoin:: sighash:: TapSighashType :: Default ,
10891090 } ;
10901091 ser_schnorr_sigs. push ( schnorr_sig. to_vec ( ) ) ;
10911092 schnorr_sigs. push ( schnorr_sig) ;
@@ -1100,10 +1101,10 @@ mod tests {
11001101 let secp_ref = & secp;
11011102 let vfyfn = |pksig : & KeySigPair | match pksig {
11021103 KeySigPair :: Ecdsa ( pk, ecdsa_sig) => secp_ref
1103- . verify_ecdsa ( & sighash, & ecdsa_sig. sig , & pk. inner )
1104+ . verify_ecdsa ( & sighash, & ecdsa_sig. signature , & pk. inner )
11041105 . is_ok ( ) ,
11051106 KeySigPair :: Schnorr ( xpk, schnorr_sig) => secp_ref
1106- . verify_schnorr ( & schnorr_sig. sig , & sighash, xpk)
1107+ . verify_schnorr ( & schnorr_sig. signature , & sighash, xpk)
11071108 . is_ok ( ) ,
11081109 } ;
11091110
0 commit comments