2020
2121use bdk:: bitcoin:: blockdata:: opcodes;
2222use bdk:: bitcoin:: blockdata:: script:: { Builder , Script } ;
23- use bdk:: bitcoin:: blockdata:: transaction:: { OutPoint , SigHashType , TxIn , TxOut } ;
23+ use bdk:: bitcoin:: blockdata:: transaction:: { EcdsaSighashType , OutPoint , TxIn , TxOut } ;
2424use bdk:: bitcoin:: consensus:: encode:: serialize;
2525use bdk:: bitcoin:: hash_types:: { PubkeyHash , Txid } ;
2626use bdk:: bitcoin:: hashes:: { hash160, sha256d, Hash } ;
@@ -232,7 +232,7 @@ pub fn verify_proof(
232232
233233 // Verify the SIGHASH
234234 if let Some ( ( i, _psbt_in) ) = psbt. inputs . iter ( ) . enumerate ( ) . find ( |( _i, psbt_in) | {
235- psbt_in. sighash_type . is_some ( ) && psbt_in. sighash_type != Some ( SigHashType :: All )
235+ psbt_in. sighash_type . is_some ( ) && psbt_in. sighash_type != Some ( EcdsaSighashType :: All . into ( ) )
236236 } ) {
237237 return Err ( ProofError :: UnsupportedSighashType ( i) ) ;
238238 }
@@ -446,7 +446,7 @@ mod test {
446446
447447 let message = "This belongs to me." ;
448448 let mut psbt = get_signed_proof ( ) ;
449- psbt. global . unsigned_tx . input . truncate ( 1 ) ;
449+ psbt. unsigned_tx . input . truncate ( 1 ) ;
450450 psbt. inputs . truncate ( 1 ) ;
451451
452452 wallet. verify_proof ( & psbt, message, None ) . unwrap ( ) ;
@@ -460,7 +460,7 @@ mod test {
460460
461461 let message = "This belongs to me." ;
462462 let mut psbt = get_signed_proof ( ) ;
463- psbt. global . unsigned_tx . output . clear ( ) ;
463+ psbt. unsigned_tx . output . clear ( ) ;
464464 psbt. inputs . clear ( ) ;
465465
466466 wallet. verify_proof ( & psbt, message, None ) . unwrap ( ) ;
@@ -488,7 +488,7 @@ mod test {
488488
489489 let message = "This belongs to me." ;
490490 let mut psbt = get_signed_proof ( ) ;
491- psbt. inputs [ 1 ] . sighash_type = Some ( SigHashType :: SinglePlusAnyoneCanPay ) ;
491+ psbt. inputs [ 1 ] . sighash_type = Some ( EcdsaSighashType :: SinglePlusAnyoneCanPay . into ( ) ) ;
492492
493493 wallet. verify_proof ( & psbt, message, None ) . unwrap ( ) ;
494494 }
@@ -508,7 +508,7 @@ mod test {
508508 network : Network :: Testnet ,
509509 }
510510 . script_pubkey ( ) ;
511- psbt. global . unsigned_tx . output [ 0 ] . script_pubkey = out_script_unspendable;
511+ psbt. unsigned_tx . output [ 0 ] . script_pubkey = out_script_unspendable;
512512
513513 wallet. verify_proof ( & psbt, message, None ) . unwrap ( ) ;
514514 }
@@ -521,7 +521,7 @@ mod test {
521521
522522 let message = "This belongs to me." ;
523523 let mut psbt = get_signed_proof ( ) ;
524- psbt. global . unsigned_tx . output [ 0 ] . value = 123 ;
524+ psbt. unsigned_tx . output [ 0 ] . value = 123 ;
525525
526526 wallet. verify_proof ( & psbt, message, None ) . unwrap ( ) ;
527527 }
0 commit comments